Accessing a row within a drawer on a tab with Javascript


I’m relatively new to Skuid. I’m attempting to explore using the javascript in-line snippets. My goal is to validate a character limit for a text field. (Feel free to point me at a relevant tutorial)

I’ve inherited a page with a lot going on, which is part of the complication of understanding.

I have a table with a row action that opens a drawer. Let’s say this table is related to model A.

Once the drawer opens, the drawer has (in this order):
-1. a button set component for Model A
-2. a table component for Model B
-3. a field editor component for Model C
-4. a responsive grid containing another field editor for Model C. In this field editor is the text field that I would like to access and validate.

I have added a new button set component in the responsive grid from 4. I set the Model to Model C (the model that has the field in it). I added ‘Id of record = Id of row in context’ to the context tab (blindly, since I’ve read that is required sometimes).

The newly added button has one action that runs the javascript snippet I created. The javascript snippet is just writing to the console right now.

Currently, I am just trying to access the data in the desired text field since that is the first step to validating a character limit. I have been console logging the ‘params’ object when the button is clicked (via action framework).

I’ve worked my way through the object to params.context.component.context, not that I really understand the hierarchy, the data just looks right in the console. This seems to be about as far down as I can go, but the context row at this point seems to be Model A instead of Model C.

My question is, should it be Model C? and if so, where did it go wrong? If it should be Model A, as it is, what’s the best way to get to the related Model C data? I have Model C’s record id in Model A, but my understanding is that I need the row in Model C, not just the data.


A quick way to test whether you are getting data you expect in the button set is to use merge syntax in a button title. {{FieldName}} Or have the button show message with {{FieldName}} in it .

I think the context statement you blindly created might not be right. You need to think about the appropriate relationships between the models. If they are on the same object, then and ‘Id of record = Id of row in context’ is going to be correct. But if they are different objects you need to traverse the relationship. On a list of accounts - the drawer showing the contacts for those accounts would need a contexgt statement like ‘accountId of record = Id of row in context’.

You are close. Lets get this fixed.