Hide UI Action on the basis of certain conditons
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-27-2023 04:03 AM
I want to hide UI action on the basis of certain condition. I have written script include and I am calling that script include in UI action condition. It is not going in script include, I am not getting logs as well. Can anyone please help as it is not working as expected.
Script include :
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-27-2023 04:09 AM - edited 12-27-2023 04:14 AM
try to call this function from background script and see it the log is working or not.
instead of current pass the gliderecord object of a record
OR
I have some suggestion to your Script as well
Script Include
In UI Action condition :
new smdrsOlaScoringCompleted().allowOlaScoring(current)
above line is enough instead of " new smdrsOlaScoringCompleted().allowOlaScoring(current) == 'true' "
Thanks
Vipin Mathew

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-27-2023 04:20 AM
Hi there,
Script Include looks oke. Maybe it's the condition field and the usage or ||
Can you update this using:
current.isValidRecord() && (current.state == 1 || current.state == 8 || current.state == 19 || current.state == -7) && new smdrsOlaScoringCompleted().allowOlaScoring(current)
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-27-2023 04:22 AM
I just tested your Script Include = oke. So do look at the condition like I mentioned. When I test with a simple condition to just trigger the Script Include, works fine.
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-27-2023 04:34 AM
it doesn't work, tried with your suggestion. it doesn't show the button itself when I do that.