The CreatorCon Call for Content is officially open! Get started here.

HIde 'Closed Cancelled' state on catalog task when catalog item has the Cancellable checkbox checked

othomas1
Kilo Guru

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?

1 ACCEPTED SOLUTION

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

LinkedIn

View solution in original post

63 REPLIES 63

Other client scripts are working fine.

Here is some screenshots of BR i just recreated:

Client Script:

 

This is working fine.

Try to alert "g_scratchpad.u_cancellable" see whether you are getting any value or not.

 

Regards,

Mandeep

 

This is the same as I mentioned before, what Brian mentioned today, why mentioning this for the 3rd time?

There seems to be something different wrong. Even a addErrorMessage at the start of the Client Script is not working. So this has nothing to do with the Business Rule (which we already validated that is was correct).

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

Hey Mark, i am sorry if it does hurt you.

But i am not saying anything is wrong in BR i just shared my tried scripts. I am just trying to help him out with table details for scripts.

If you go through my reply you can see i am asking for alert in client scripts. so don't take it too hard.

Regards,

Mandeep

Would that be alert(g_scratchpad.u_cancellable);? The other suggestions did not work either.