
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2019 06:22 AM
On Change task, I want to check if Planned start date is in future.
If future, abort action
if past, continue
I tried the below code in Client script but doesn't validate.
var plannedStart = g_form.getValue('planned_start_date');
//get Date object using user's display format
var tzPlan = getDateFromFormat(plannedStart, g_user_date_time_format);
var currentDt = new Date();
if(tzPlan > currentDt)
return false;
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2019 04:51 AM
Hi
Try the below code in client script
var start_d = getDateFromFormat(g_form.getValue('planned_start_date'), g_user_date_time_format);
var end_d =new Date();
if (start_d > end_d) {
return false;
}
Regards
Ravindra
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2019 06:26 AM
Hi Nithin,
Find the below link it will guide you to the solution
https://community.servicenow.com/community?id=community_question&sys_id=d8ce0b61dbdcdbc01dcaf3231f961929
Mark it correct/helpful if it helps you
Regards
Ravindra

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2019 04:34 AM
Hi Ravi,
I am trying in Client side. The mentioned thread is discussing Server side.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2019 04:51 AM
Hi
Try the below code in client script
var start_d = getDateFromFormat(g_form.getValue('planned_start_date'), g_user_date_time_format);
var end_d =new Date();
if (start_d > end_d) {
return false;
}
Regards
Ravindra
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2019 04:58 AM
Please refer below thread,