- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-07-2015 05:28 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-07-2015 07:59 AM
Hello srnewbie,
You beat me to it!
Here is my code, yours look way cleaner. Thank you for sharing your solution.
function onLoad() {
var today = new Date();
var inThreeDays = new Date();
inThreeDays.setDate(today.getDate() + 3);
var inThreeDaysFormatted = inThreeDays.getFullYear() + '-' + ('0' + (inThreeDays.getMonth() + 1)).slice(-2) + '-' + ('0' + (inThreeDays.getDate() + 1)).slice(-2);
console.log(inThreeDaysFormatted);
g_form.setValue('due_date',inThreeDaysFormatted );
}
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-07-2015 07:15 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-07-2015 07:24 AM
when I try this I get following error Access to Script Include HelloWorld blocked from scope.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-07-2015 07:40 AM
Did you set the 'Accessible from' field to 'All application scopes'?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-07-2015 07:55 AM
Yes.
I was able to set due date using JS as suggested by Edwin Munoz. below is my code
function setDueDate(num_of_days)
{
var days_to = parseInt(num_of_days);
var now = new Date();
now.setDate(now.getDate() + days_to);
var duedate = now.getFullYear() + '-' + ('0' + (now.getMonth() + 1)).slice(-2) + '-' + ('0' + now.getDate()).slice(-2) + ' ' + ('0' + (now.getHours())).slice(-2) + ':' + ('0' + now.getMinutes()).slice(-2) + ':' + ('0' + now.getSeconds()).slice(-2);
g_form.setValue('due_date',duedate);
}
Thanks for all the help Mike Allen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-07-2015 07:59 AM
Hello srnewbie,
You beat me to it!
Here is my code, yours look way cleaner. Thank you for sharing your solution.
function onLoad() {
var today = new Date();
var inThreeDays = new Date();
inThreeDays.setDate(today.getDate() + 3);
var inThreeDaysFormatted = inThreeDays.getFullYear() + '-' + ('0' + (inThreeDays.getMonth() + 1)).slice(-2) + '-' + ('0' + (inThreeDays.getDate() + 1)).slice(-2);
console.log(inThreeDaysFormatted);
g_form.setValue('due_date',inThreeDaysFormatted );
}
Thanks.