So I’m making a wizard to delegate a case to a different user (using a custom ‘delegated to’ field, instead of changing owner)
I also have a Due_Date__c field.
In the wizard, I’d like to set the Due_Date__c field to ‘Today’ if there’s no value.
I’m using the Action Framework on the ‘next step’ button on step1 of the wizard.
- I can use an action to set the Due_Date__c field to Today, but that unconditionally overwrites the existing date if is already set.
So I made the below inline snippet, based on one I found to another question, as an Action step, followed by a navigate to step2 action.
Console output shows it’s updating the field, but when step2 loads, the Due_Date__c field is still blank.
I tried adding a save-model action, and that works, but I’d like to have the wizard ‘cancelable’.
(What’s the correct way to post code?)
var params = argumentsl0], step = params.step, $ = skuid.$; var caseDataModel = skuid.model.getModel('CaseData'); var thisCaseData = caseDataModel.getFirstRow(); var dueDate = thisCaseData.Due_Date__c; if (!dueDate) { console.log('!dueDate'); dueDate = Date(); console.log(dueDate); caseDataModel.updateRow(thisCaseData,'DueDate__c',dueDate); // $.each(caseDataModel.registeredItems,function(){ // this.refreshFields(); // }); } var testCaseData = caseDataModel.getFirstRow(); var newDueDate = testCaseData.Due_Date__c; console.log('Test dueDate=' + dueDate);