How can I allow users to edit a field on a particular model that is accessed via lookup?

  • 1
  • Question
  • Updated 8 months ago
  • Answered
I have a model querying Contact and a table + drawer that pulls from that model. I would like users to be able to edit fields on a given contact's account. I'm using the standard AccountId lookup field to add these account fields to the Skuid page, but they can't be edited (only viewed) when using the page.

Is there a way to make them editable?

In the attached screenshot, the highlighted fields are the Account fields and the single "Default Event List" checkbox is on the Contact (which is editable). The two account checkboxes are accessed as "Account.No_Solicitations__c" and "Account.Postal_Mail_Opt_Out__c" in the model.

Photo of Matt

Matt

  • 102 Points 100 badge 2x thumb

Posted 8 months ago

  • 1
Photo of Skuidward Tentacles (Raymond)

Skuidward Tentacles (Raymond), Champion

  • 17,224 Points 10k badge 2x thumb
Best way I have found is to add a row action that opens the record you want to edit in a pop up or sliding panel. You will need a separate model based on the object in the look up. Your row action will first activate and set the value of a condition on that model limiting it to the appropriate ID. Then requery the model, then open the pop up to display a table or field editor on the model.
Photo of Matt

Matt

  • 102 Points 100 badge 2x thumb
Thanks, Raymond.

I decided to go with your popup approach. The edit button in the "Account Info" section queries the Account model and sets a condition to use just the ID of the current row's parent account. This actually works perfectly. When I click "Save & Close" the Account model is saved (and the individual account record is updated), but the row I launched it from is not updated.

How can I update that row when the popup is closed to reflect the changes made in the popup?

I've tried to query the model powering the table in the "Actions on Close" for the popup, but it doesn't seem to force a refresh on the page. I also tried to do the same from the actions in the "Save & Close" button.

(Edited)
Photo of Skuidward Tentacles (Raymond)

Skuidward Tentacles (Raymond), Champion

  • 17,224 Points 10k badge 2x thumb
Not sure why that isn’t working....Make sure on requery that it is set to reload the whole model, not just new rows.
Photo of Matt

Matt

  • 102 Points 100 badge 2x thumb
I played around with the model options and got it working somehow.

After close, it reloads the table, and if I expand the drawer for the row it shows the edits.

Is there a way to automatically expand the drawer of the record that was just edited? Perhaps with js?
Photo of Skuidward Tentacles (Raymond)

Skuidward Tentacles (Raymond), Champion

  • 17,224 Points 10k badge 2x thumb
Instead of using a drawer, you may want to do a pop up or sliding panel. It might improve the workflow.
Photo of Matt

Matt

  • 102 Points 100 badge 2x thumb
Thanks for the help! I appreciate it.