- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2023 05:08 AM
Requirement: Offboarding request catalog item have a date variable, it should always be a future date after atleast 2 weeks from the date of request submission.
Any help is greatly appreciated!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2023 02:31 AM
Hi @arjunchatla
You can try this onChange client script on your variable.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var date_number = getDateFromFormat(g_form.getValue('YOUR_VARIABLE_NAME'), g_user_date_format);
var selected_date = new Date(date_number);
var target_date = new Date();
target_date.setDate(target_date.getDate() + 13);
if(selected_date < target_date){
g_form.clearValue('YOUR_VARIABLE_NAME');
g_form.addErrorMessage("The selected date should be atleast after 14 days");
}
}
Please mark my answer helpful and accept as a solution if it helped 👍✔️
Anvesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2023 08:07 PM
Hi @Tai Vu
Thanks for your answer, but it didn't work for me. May be I did something wrong.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2023 08:22 PM
Hi @arjunchatla
Oops! I see. The validation is "always be a future date after at least 2 weeks from the date of request submission."
So the condition above from my screenshot should be Before (Not After).
Cheers,
Tai Vu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2025 02:50 PM
Matt from ReadyCloud here,
This is a great approach for enforcing offboarding timelines in ServiceNow. We actually have an app in the ServiceNow Store that automates the entire device return process and plugs directly into your existing offboarding workflows. Instead of the traditional "ship a box and wait", the offboarded employee receives a QR code via email or text and simply drops off their gear at the UPS. The app also handles automated follow-up, cutting shipping time in half, reducing time spent on chasing gear, and significantly improving return rates. Let me know if you have any questions.