Evaluating condition fields

Mark Roethof
Tera Patron
Tera Patron

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

LinkedIn

1 ACCEPTED SOLUTION

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.

View solution in original post

9 REPLIES 9

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

LinkedIn

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.

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

LinkedIn

any update on this thread ?

if your query has resolved kindly select the correct answer and close this thread. 

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

LinkedIn