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.

HOW to call script include from refrence Qualifier

dheeru_1994
Tera Contributor

Hii All i have two fields one field name is demo1 which is refrence type refrence is of group table , second field name is company which is list type and refrence give it of user table , now my requirement is that when i select any group in demo field how many user are in that group should populate in company field i make script include my script is below getGroupMembers: function(groupId) { var groupMembers = []; var gr = new GlideRecord('sys_user_grmember'); gr.addQuery('group', groupId); gr.query(); while (gr.next()) { groupMembers.push(gr.user.toString()); } gs.info('Group ID: ' + groupId); gs.info('Group Members: ' + groupMembers.join(', ')); return groupMembers; }, type: 'GroupMemberScriptInclude' }; now this script include need to call from refrence qualifier , here i do not know on which field refrence qualifier use to achive this i tried but no luck thanks

1 ACCEPTED SOLUTION

Hello @dheeru_1994 ,

 

You can write a onchnage client script on group field and depending on that you can set the value of list collector field by using simililar script include.

View solution in original post

6 REPLIES 6

HII Sir 
what if i need same value populate in list type because in our general form list collector type do not availble 
so same thing can be achieve this 

Hello @dheeru_1994 ,

 

You can write a onchnage client script on group field and depending on that you can set the value of list collector field by using simililar script include.