Use updateRow to update a parent model?

  • 1
  • Question
  • Updated 3 years ago
  • (Edited)
Javascript doesn't like this:

model.updateRow(row, {Patient_Case__r.Estimated_Due_Date_by_U_S__c: null});

It's expecting ':' and getting '.' after Patient_Case__r. What's the best way around this? I'd rather not have to create a model on the Patient Case object.

Thanks!
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb

Posted 3 years ago

  • 1
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
Notes:

I attempted 
Patient_Case__r: {Estimated_Due_Date_by_U_S__c: null}
but this had no effect.

I also attempted putting quotes around the field:
'Patient_Case__r.Estimated_Due_Date_by_U_S__c': null. 
This created a "field" in the model's data object called Patient_Case__r.Estimated_Due_Date_by_U_S__c with a value set to null, but it did not change the value of Estimated_Due_Date_by_U_S__c in the Patient_Care__r object in the model's data.
(Edited)
Photo of Zach McElrath

Zach McElrath, Employee

  • 49,056 Points 20k badge 2x thumb
Matt, are you trying to actually have this change affect the related Patient Case record in Salesforce? This is not possible using the above syntax --- when you go to save, Skuid will strip out any "related object" updates that you pass in to it --- i.e. if your Field name contains a "." in it somewhere, Skuid will not perform this save. You will have to have a separate Model on the Patient Case and update that model separately, then save that Model as well.
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
Zach,

Yes, I want to change the parent record in SFDC without creating a model on the parent object.

It looks like I found a way to do it (although not an officially supported way):

var model = arguments[0].model,	row = model.getFirstRow(),
$ = skuid.$;
row.Patient_Case__r.Estimated_Due_Date_by_U_S__c = null;