- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-12-2024 08:09 AM - edited 08-12-2024 08:09 AM
Hello, I want to create an error message for a question. The question (date) variable is: what_is_the_expected_date_that_the_refresh_must_be_completed_by
The error message should say "Load release across partitions can only be completed on weekends." when users select thursday as a date AND say yes to variable load_release_across_partition.
This is a known problem with SN PRB1694977 as for some reason Thursdays don't work in the UI builder. Support told me ill need to script this one out. I am not too familiar with scripting, is someone able to help me with this?
If more background is needed please see my other post: Re: Can someone explain why trend by Thursday does... - Page 2 - ServiceNow Community
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-13-2024 09:34 AM
Hi @Andrew Meza ,
Sharing the update set xml to you.
Catalog name is Weekday Catalog item.
After importing just hit the url,
/esc?id=sc_cat_item&sys_id=207ba938c3cc521017aeb61ed40131ee
I believe this will help you.
Regards,
Najmuddin.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-13-2024 10:12 AM
Hi @Andrew Meza ,
Sorry, did not understand the question. Is it not working on Mon and Tuesday ?
Regards,
Najmuddin.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-13-2024 10:23 AM
Yes, and actually...
Monday = allows you to select (not how we want it)
Tuesday = allows you to select (not how we want it)
Wednesday = works great
Thursday = works great
Friday = works great
Saturday = does NOT let you select (not what we want)
Sunday = does NOT let you select (not what we want)
Its like its off by 2 days.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-13-2024 10:33 AM
Hi @Andrew Meza ,
In the Script Include, on the 12th line, debug the day field. Add gs.addInfoMessage(day).
Now select the days on the form, and you will be getting the info message with day value.
Now, add those values in the if and else block which you want to return true or false.
I think there might be any date format configuration.
If this information finds you helpful, please mark as Helpful and Accept the solution.
Regards,
Najmuddin.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-13-2024 10:35 AM
Hi @Andrew Meza ,
Also delete the script include which you created earlier. Since the names are same, they may be conflicting.
Regards
Najmuddin.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-13-2024 12:03 PM
Like this? I apologize if I am far off my coding knowledge is very minimal.
//Lines 10-15 below
gs.print(gcdt);
var day = gcdt.getDayOfWeekLocalTime(); // return the local day number
gs.addInfoMessage(Monday, Tuesday, Wednesday, Thursday, Friday);
if (day == 7 || day == 6) {
// gs.addInfoMessage("weekend");
return true;
