Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Comparison of Roles

madhusudanshett
Kilo Contributor

Hi Everyone

Using the following code I am capturing the sys_id of the logged in user in an array.

var gr11 = new GlideRecord('sys_user_role');

  gr11.addQuery('name', gs.getUser().getRoles());

  gr11.query();

  gr11;

  var qry2;

  var objArray2 = [];

  while(gr11.next()) {

  objArray2.push(gr11.sys_id.toString());

  }

We have a role field in "sys_app_module" table of type "User Roles".

User Roles.png

How can I compare the roles field of sys_app_module table with the values(sys_ids) in an array?

ChrisB

Please assist me on this.

Thank you

5 REPLIES 5

Ad-Allround3r
Tera Contributor

As this is a real old forum record with the Access Analyser Plugin https://www.servicenow.com/docs/bundle/xanadu-platform-security/page/integrate/identity/concept/expl... the topic is already solved.