Hello stackexchange gurus.
I have a problem with setting a future Due Date for a task using javascript in Salesforce. Below is the piece of code i use:
var d = new Date();
d.setDate(d.getDate()+7);
var date =(d.getDate()+"/"+(d.getMonth()+1)+"/"+d.getFullYear()).dateFormat;
taskToCreate.ActivityDate = date;
Unfortunately, the result of this code is empty "Due Date" field. In case i get rid of .dateFormat
, the error will appear, saying something like "incorrect value format for required field".
In case there is a simplier solution for setting Due Date as "7 days from today's date", i'd be grateful if you share your knowledge.
I was unable to find the answer on my own, and i will really appreciate any advice on that issue.
Thank you in advance, Best Regards.
sforce.internal.dateTimeToString(new Date())
function to the work done.