- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-29-2022 07:08 AM
I have this UI Action that I only want visible if a value stored on a record from a different table is true.
The condition would look something like this:
new GlideRecord('other_table').addEncodedQuery(active=true^foo=current.foo).query().next().bar == true && current.status == '1'
However, when I save, SN gives me this error:
Use two equal signs to test equality; conditions should not do assignment
What am I doing wrong?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-29-2022 07:11 AM
Move the gliderecord part of the condition to a script include and call the script include from the condition field.
Thats the traditional way to do it.
Edit : You will have to return a true or a false from the script include based on your requirement

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-29-2022 07:11 AM
Move the gliderecord part of the condition to a script include and call the script include from the condition field.
Thats the traditional way to do it.
Edit : You will have to return a true or a false from the script include based on your requirement
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-29-2022 07:36 AM
Hi,
Please check below link:
Calling a Script Include in a UI Action? - Developer Community - Question - ServiceNow Community
you can write this login in script include to return true/false and call script include in condition.
Thanks,
Teju D.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-29-2022 08:48 AM
I know this was answered but you can do it the way you were, but you need to do it a bit differently