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.

Need help for Catalog UI Policy Script using AJAX calls

alex_tan
Kilo Contributor

Hi All,

Need some advice on the following:

I have a variable named "Groups" in my Catalog Item, i am trying to populate the list of groups that a portal requestor belongs to into the variable when the requestor is submitting a new request.

(He/She can choose the group that is required)


I did some testing and managed to do this in the background script, can someone help to advice how to write something similar under Catalog UI Policy -> Script using AJAX calls?

      var groups = [];

      var gr = new GlideRecord('sys_user_grmember');

      var userID = gs.getUserID();

      gr.addQuery('user', userID);

      gr.queryNoDomain();
            
      while(gr.next())

      {      

      groups.push(gr.group);
                            
      }

Thank you for your help.

5 REPLIES 5

Hi Alex,

Any update on this?
Can you mark my answer as correct, helpful if you were able to achieve the requirement. This helps in removing this question from unanswered list and helps users to learn from your thread. Thanks in advance.

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader