How to modify business role based on time zone?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-04-2025 01:25 AM
I have the following client script code:
The code for the business role is as follows:
Thank you very much if you could provide specific modification methods
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-04-2025 01:31 AM
what's your actual business requirement?
If my response helped please mark it correct and close the thread so that it benefits future readers.
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-04-2025 01:38 AM
Using the following business role, the current time zone is Tokyo, and obtaining the week start on Monday is not a problem. But when I change the time zone of snow to us, due to the time difference, the 'day' obtained by the business role below is not equal to '1', which will result in an error. So I would like to ask if it is necessary to modify the code logic of the business role. How should I modify it?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-04-2025 01:59 AM
what's your business requirement?
You are sharing the issue faced in the technical implementation
If my response helped please mark it correct and close the thread so that it benefits future readers.
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-04-2025 01:41 AM
@shiz remove the quotes for day! = 1
function executeRule(current, previous /*null when async*/) {
var weekStartOn = new GlideDateTime(current.u_week_starts_on);
var day = weekStartOn.getDayOfWeekLocalTime();
// Check if the selected day is NOT Monday (Monday = 1)
if (day != 1) {
gs.addErrorMessage(gs.getMessage('check_week_start_on'));
current.setAbortAction(true);
}
}
Thank you.
Omkar