I have a DateTime field that I would like to add 1 hour to in a multiple action.
I have set the multiple action to update the destination field (which is also a DateTime field and both are selected in the Model) by setting the option to a specific date and then I used {{$Model.Modelname.data.0.field}} as the value but I am not sure of the syntax or format to add 1 hour to the value?
This is almost always going to be a javascript statement. Fortunately - one of the actions you can invoke in the actions framework is a “snippet” The snippet you’d write would convert the date/time field to a javascript object. Add an hour to that object, convert it back to a salesforce object and then save the field.
Should be pretty straightforward.
Thanks Rob.
For us Javascript newbies do you have a sample pleeeaaaase?
Your probably going to want to check out this doc : http://help.skuidify.com/m/11720/l/129505-skuid-time but something like this might work…
var params = argumentse0], $ = skuid.$;<br>var model = skuid.$M('YOURMODEL');<br>var row = model.getFirstRow();<br>var dateVar = row.Your_Date_Field__c;<br>//convert from Salesforce date to Javascript date<br>var jsDate = skuid.time.parseSFDate(dateVar);<br>//add an hour <br>jsDate.setHours(jsDate.getHours() + 1);<br>//convert from Javascript date back to Salesforce date<br>var hourAdded = skuid.time.getSFDate(jsDate);
model.updateRow(row,{Your_Date_Field__c : hourAdded});
If you’re using a datetime field change “parseSFDate” and “getSFDate” to “parseSFDateTime” and “getSFDateTime”.
Thanks Moshe.
You are a * !!!
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.