Skip to main content
Nintex Community Menu Bar
Question

How to add 1 hour to a DateTime field in Multiple Actions?

  • July 9, 2024
  • 5 replies
  • 23 views

Forum|alt.badge.img+7

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 topic has been closed for replies.

5 replies

Forum|alt.badge.img+17
  • Nintex Employee
  • July 9, 2024

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. 


Forum|alt.badge.img+7

Thanks Rob.

For us Javascript newbies do you have a sample pleeeaaaase?


Forum|alt.badge.img+9

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 = arguments[0],&nbsp; &nbsp;$ = 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&nbsp;<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});


Forum|alt.badge.img+9

If you’re using a datetime field change “parseSFDate” and “getSFDate” to “parseSFDateTime” and “getSFDateTime”.


Forum|alt.badge.img+7

Thanks Moshe.  

You are a *  !!!