
- 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 02:23 AM
If I execute something like below, in most cases it will return true or false, what is exactly what I'm after. Only when the condition has something like vaVars.switchTopic() it fails. Kinda logical, because that's specific Virtual Agent. Though when executing this Scoped... not supported @#(@!!^!*$
var gr = new GlideRecord('sys_cs_topic');
if(gr.get('257ace94dbe9fb8069fb9ea9db961993')) {
var x = GlideRhinoHelper.evaluateAsBoolean(gr.applicability)
gs.info(x);
}
Conditions like below are evaluated correctly in global scope, to true or false.
(function execute() {
return false;
})()
true
(function execute() {
var incidentGr = new GlideRecord('incident');
return incidentGr.canWrite();
})()
What fails to execute, due to the vaVars, though logical.
(function execute() {
return vaVars.switchTopic;
})()
Any ideas on the scoped part?
Kind regards,
Mark
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 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 10:40 AM
Interesting thought about using a global Script Include. I will look into this!
Kind regards,
Mark
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-13-2019 01:56 AM
any update on this thread ?
if your query has resolved kindly select the correct answer and close this thread.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-29-2019 02:02 AM
No really how I wanted to solve this, though with a global Script Include is a solid workaround. Is working fine.
Thanks!
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