Table Row Action does not update field in model on "Update a field on row(s)"

  • 1
  • Question
  • Updated 2 years ago
  • Answered
I have a Model that has an action, "Row in Model updated." When this salesforce lookup field is updated, i want it to populate another field on that same row. I am following a similar pattern for another Lookup field in the row, however this other field is not updating the same.

My action is set up to Update a field on row(s). The funny thing is that if i put the field that i want, {{Asset__r.Account_Number__c}}, field does not update. If i put any other field, i.e. Name, Id it seems to work fine. I know i have permissions to the field i want as i can view it from the standard Salesforce UI. Also i am a SysAdmin profile so i can see everything.

Any clues why this action update would only work on certain fields?
Photo of Val

Val

  • 112 Points 100 badge 2x thumb

Posted 2 years ago

  • 1
Photo of Mark DeSimone

Mark DeSimone, Official Rep

  • 12,066 Points 10k badge 2x thumb
Hi Val. Do you see any JS errors on the browser console when this update fails? If so, would you mind sharing them here?
Photo of Val

Val

  • 112 Points 100 badge 2x thumb
Photo of Mark DeSimone

Mark DeSimone, Official Rep

  • 12,066 Points 10k badge 2x thumb
Thank you. I'm not sure those errors are related to your issue in this case.

When you add a field like you have here: Asset__r.Account_Number__c, where the contents are actually being pulled from another model, it's treated as read-only. Instead, I'd recommend you try to add a new model to your page that directly pulls the Account_Number__c field from its own object, and have your row action update that field on that model instead. 
Photo of Val

Val

  • 112 Points 100 badge 2x thumb
The field i am referencing, Asset__c, is a lookup on my Skuid model. It does work though if I reference the Name or Id field though? Is this just luck that it is able to pull the values, Asset__r.Id or Asset__r.Name? As i mentioned in the original post, the I am following this same pattern for a different Lookup field and it is working as expected.

I can try to populate another model whenever that value is updated, but seems like a lot of extra steps.
Photo of Mark DeSimone

Mark DeSimone, Official Rep

  • 12,066 Points 10k badge 2x thumb
Is Asset__r.Account_Number__c included in the list of fields on your Skuid model? If not, try adding it to the model. 
Photo of Val

Val

  • 112 Points 100 badge 2x thumb
Yes it is. Asset_r.Name is as well. However, Asset__r.Id is not. The other field that works during the Action update row, {{Equity_Position__r.Ticker__c}}, is also in my model.
Photo of Barry Schnell

Barry Schnell, Champion

  • 18,376 Points 10k badge 2x thumb
Hello Val -

If I'm understanding your situation correctly, the user is choosing a value for Asset__c and when they do, you want to use Asset__r.Account_Number__c to update another field on the same row as Asset__c.

In this case, you need to ensure you have two things configured:

1) As Mark mentions, you need to make sure you have Asset__r.Account_Number__c in your model.

2) Asset__r.Account_Number__c is included in the "search" fields for the Asset__c field where the user picks that value. If not, the Asset__r.Account_Number__c will not be returned in the "lookup" and therefore not available for use.

The reason Id & Name work is because Skuid automatically includes those two fields on every SOQL call (even if you don't have them defined explicitly in the model or in the lookup search fields).

If you add #2, it should work as you expect.  If it doesn't please let us know.

Hope this helps!
(Edited)
Photo of Val

Val

  • 112 Points 100 badge 2x thumb
Thanks Barry! That was it! Just added it to my the Search field and now the action works.
Photo of Barry Schnell

Barry Schnell, Champion

  • 18,376 Points 10k badge 2x thumb
Great news, glad it worked Val!