
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-10-2019 11:55 PM
Hi all,
Just for testing purposes, I'm wondering how to evaluate condition fields. Specifically, if a user would have access based on the condition field.
For example, a condition field which contains:
(function execute() {
return false;
})()
Or:
(function execute() {
var incidentGr = new GlideRecord('incident');
return incidentGr.canWrite();
})()
How can I check, if the condition in the condition field, evaluates to true for the logged in user? Any ideas?
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
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-11-2019 02:32 AM
GlideRhinoHelper is not allowed in scoped applications.
just another way,, can you try to write one script include in global scope and then make the scope for all
application scope and then try to call it , see if that is working or not. i think this way it will work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-11-2019 12:23 AM
Hi,
Your condition fields are executed on server side and they expect true or false to allow whatever there purpose is.
Not sure why would someone use IIFE in condition field however, it can be used.
For evaluation, I'll suggest to either add info messages or add logs in sytem to evaluate whether your condition script returned true or not.
Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-11-2019 12:36 AM
For example, Virtual Agent topics contain such conditions. Though, If I would like to present a list of topics to a user, I would only like to present the topics the user has access to. Therefor I need to evaluate these conditions, which are stored in a field. Though, how?
I know within Topics there is a vaSystem property. Though, this concerns using this in a Business Rule for example where obviously we don't have the vaSystem property available.
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
11-11-2019 01:00 AM
I am able to evaluate most conditions in the field with below code. Though not all unfortunately, also not Scoped 😞
GlideRhinoHelper.evaluateAsBoolean(gr.applicability)
Any ideas?
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
11-11-2019 01:21 AM
did you try to run this in your background script ? if yes what is the result it's giving you ?