
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2019 11:12 PM
I want to make a Planned Start Date Validation wherein a pop-up message will appear if the selected Planned Start Date is more than 7 days to the current date.
Thanks!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2019 11:26 PM
Hi Kate,
So the planned start date should not be more than 7 days from now
You can use UI policy on change request table for this with condition as below:
script: for execute if true
alert("Please select planned start date within 7 days from now");
g_form.clearValue('planned_start_date'); // use proper field name here
Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2019 11:26 PM
Hi Kate,
So the planned start date should not be more than 7 days from now
You can use UI policy on change request table for this with condition as below:
script: for execute if true
alert("Please select planned start date within 7 days from now");
g_form.clearValue('planned_start_date'); // use proper field name here
Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2019 11:32 PM
Thank you!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2019 11:37 PM
If you want Business Rule.
before and insert,update checked
Condition : Planned start date changes or isnot empty
script
var getPlannedDate = current.start_date;
var dc = new DurationCalculator();
dc.setSchedule('08fcd0830a0a0b2600079f56b1adb9ae'); // this is the sys_id of 8-5 weekday schedule in the instance.
dc.setTimeZone('GMT');
var dur = dc.calcScheduleDuration(gs.now(),getPlannedDate)/3600;
var res = dur.toString();
if(parseInt(res)>= 45){ // Check for days
gs.addErrorMessage("Please select planned start date within 7 days from now");
current.setAbortAction(true);
}
Harish

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2019 11:38 PM
How about if Planned End Date > Planned Start Date?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2019 11:48 PM
You have to play a little bit to fine-tune it, but something like below. Then only add your error message in the script.
If my answer helped you in any way, please then mark it as helpful.
Kind regards,
Mark
---
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field