- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-26-2019 10:38 AM
Hello everyone,
I thought this one was pretty straightforward so i made a client script, but when a catalog item has the Cancellable checkbox checked, i need the associated catalog tasks to not show the closed cancelled state as a choice in the dropdown, the script below is not working:
function onLoad() {
if(g_scratchpad.u_cancellable == 'false') {
g_form.removeOption('state', '4');
}
}
Can someone spot what my script is missing?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-27-2019 11:16 AM
I was thinking, since the Business Rule and Client Script itself are oke, and the addInfoMessage is simply not displayed, and you don't experience this in general with other Client Scripts:
Do you have other Client Scripts on the same form? Might these be interfering? Have you tried disabling these and retesting to see if the new Business Rule and Client Script are working? If so, then you know there's an issue or conflict with the existing Client Scripts on your form.
If my answer helped you in any way, please then mark it as helpful.
Kind regards,
Mark
---
LinkedIn
Community article list
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-26-2019 11:37 AM
I've tested successfully with u_cancellable on the Catalog Item record [sc_cat_item].
If my answer helped you in any way, please then mark it as helpful.
Kind regards,
Mark
---
LinkedIn
Community article list
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-26-2019 12:04 PM
Hi mark, my setup below did not work for me:
Business rule
Advanced:
(function executeRule(current, previous /*null when async*/) {
g_scratchpad.cancellable = current.request_item.cat_item.u_cancellable;
})(current, previous);
Client script:
function onLoad() {
g_form.addInfoMessage('running');
if(g_scratchpad.cancellable && g_scratchpad.cancellable == 'false') {
g_form.addInfoMessage('still running');
g_form.removeOption('state', '4');
}
}
Closed cancelled still shows on the list

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-26-2019 12:06 PM
Please select Display instead of default before on your business rule. Also see my first image.
If my answer helped you in any way, please then mark it as helpful.
Kind regards,
Mark
---
LinkedIn
Community article list
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-26-2019 12:12 PM
Hi mark,
I changed it to match and its still not working, im gonna see what else i may be doing wrong.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-26-2019 12:15 PM
So did any of the messages trigger?
Also add some logging (gs.info for example), to your business rule, to see if this got triggered.
If my answer helped you in any way, please then mark it as helpful.
Kind regards,
Mark
---
LinkedIn
Community article list
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field