Skip to main content

I have 2 models:  Program and Timeline, both have a field named Mail_Date__c.   When the Program model Mail_Date__c is updated, need Timeline model Mail_Date__c to update to that same date.   Action Framework only allows specific dates, so am using Snippet, but am unable to find the correct syntax.   Here is what I have so far that is not working:

var params = argumentse0], $ = skuid.$;
var model = skuid.$M(‘Timeline’);
var row = model.getFirstRow();
model.updateRow(row,{


Mail_Date__c: Program__r.Mail_Date__c
});

I assume the last line needs help.  Thanks!

Is the Timeline model is related to the Program model with the Program__c field?
Do both models have the Mail_Date__c fields?

Assuming yes to both above, then the issue is that Program__r.Mail_Date__c in Timeline model isn’t yet updated with the Mail_Date__c on Program model. It would still have the value it had when the page loaded. That’s even if you saved the Program model. You could of course requery the Timeline model, but that’s a poor UX.

I’d just add the Program model and row to the snippet in order to use it in the updateRow function. ie. programModelRow.Mail_Date__c in place of Program__r.Mail_Date__c

Cheers


Yes, the Timeline model is related to Program model with Program__c, and both models have the Mail_Date__c fields

Tried programModelRow.Mail_Date__c in place of Program__r.Mail_Date__c and still not working.

Running a test, I am able to update the Timeline field to ‘null’ without problem (below)
var params = argumentse0], $ = skuid.$;
var model = skuid.$M(‘Timeline’);
var row = model.getFirstRow();
model.updateRow(row,{


Mail_Date__c: null 
});



You may be able to accomplish this with a flow, process, or workflow if you can’t get the snippet to work.


Yup. Process will do it the easiest in SF.


Thanks for all of the suggestions!  Went with Salesforce process builder and works great!