Setting Popup Row Context

  • 1
  • Question
  • Updated 5 years ago
There seems to be an issue with the popup "smartness". I want to display to models with the same sObjects (example: Account, Related Accounts). But the popup seem to limit both models to only include the id of the row clicked. I.e related accounts will always be empty.....

Note: This conversation was created from a reply on: Run script snippet before popup.
Photo of William Sporrong

William Sporrong

  • 396 Points 250 badge 2x thumb

Posted 5 years ago

  • 1
Photo of Zach McElrath

Zach McElrath, Employee

  • 49,056 Points 20k badge 2x thumb
Hi William, looks like you're right. However, there is a workaround here. If you go into the page XML, you can change the Conditions governing what data gets into your popup table for Child Accounts. If you click "View Page XML" for your page, you should be able to do a search for "popup" and find your Row Action popup's XML. If you look inside it, you'll find the XML for your Child Accounts table, which should have a child node, which looks like this:

<condition type="contextrow" field="Id" autocreated="true"/>
These "autocreated" conditions are the "smartness" that Skuid automatically puts in while you're building popups.

If you change the field="Id" to be field="ParentId", then, as long as your accounts model has the ParentId field in it, your Child Accounts table in the popup should be filtered to just Child Accounts of the Account row in context.
(Edited)
Photo of William Sporrong

William Sporrong

  • 396 Points 250 badge 2x thumb
Thanks but I can't get this to work. Does the contextrow always take the primary key of the row to create the condition? I.e. in your example parentId = row.Id? In my case I want to use another field. Example: Show all other accounts from the same state.
Photo of Zach McElrath

Zach McElrath, Employee

  • 49,056 Points 20k badge 2x thumb
you can specify the "primary key" field / merge field to dump in with the "mergefield" attribute, e.g.

<condition type="contextrow" mergefield="MailingState" field="BillingState" operator="="/>
(Edited)
Photo of William Sporrong

William Sporrong

  • 396 Points 250 badge 2x thumb
Excellent! thanks