Skip to main content

I wish to populate the EndDateTime field on my Event model with date/time of now + 1 hour. How do I achieve this? I’ve hacked some javascript below based on some other posts but it’s failing.


var params = argumentse0], $ = skuid.$; var model = skuid.$M('Event'); var row = model.getFirstRow(); var dateVar = row.EndDateTime; //convert from Salesforce date to Javascript date var jsDate = skuid.time.parseSFDate(dateVar); //add an hour jsDate.setHours(jsDate.getHours() + 1); //convert from Javascript date back to Salesforce date var hourAdded = skuid.time.getSFDate(jsDate);
I managed to resolve this by making some small changes to the code below. And by having the snippet run as an action when a new record is created on the model var params = arguments[0], $ = skuid.$; var model = skuid.$M('Event'); var row = model.getFirstRow(); var dateVar = new Date(); var jsDate = skuid.time.parseSFDateTime(dateVar); jsDate.setHours(jsDate.getHours() + 1); var hourAdded = skuid.time.getSFDateTime(jsDate); model.updateRow(row,{EndDateTime : hourAdded});



Hi Glenn, thank you for closing the loop and sharing the resolution on this!