Make populated values ReadOnly in the selected(right) side of slushbucket

ShanmugaPriya1
Tera Contributor

Hi All,
Could I please have your help for the below requirement.

We have a form from which we can add new groups to the existing users who are already part of groups. Upon user selection, slush busket will be made visible where the "Selected" section will display the groups where User is already part of. 

We are now trying to make those values populated under the "Selected" section Ready Only but could not find any way to achieve the same. Please advise if we can achieve this. If this cannot be achieved, can we have other slushbucket in the same form so in this one will display the values existing groups user is part of and shlould not be editable and in the another "Selected" section - user can add the groups they have to be added.

 

Thanks in Advance!

1 ACCEPTED SOLUTION

To exclude groups from the Available list that the user is a member of will require replacing the reference qualifier conditions with one that calls a Script Include, like this format:

BradBowman_0-1714055451857.png

passing in a variable value for the user.  The Script Include would do a GlideRecord on the list reference table to replicate the conditions you have now, pushing the results (group sys_ids) to an array, then another GlideRecord on the sys_user_grmember table to make an array of group sys_ids that the user is a member of.  Finally, use ArrayUtil to remove groups (sys_ids) from the first array that are present in the second array and return the results like

return 'sys_idIN' + finalArray.join(',');

https://docs.servicenow.com/bundle/vancouver-api-reference/page/app-store/dev_portal/API_reference/A... 

 

View solution in original post

8 REPLIES 8

To exclude groups from the Available list that the user is a member of will require replacing the reference qualifier conditions with one that calls a Script Include, like this format:

BradBowman_0-1714055451857.png

passing in a variable value for the user.  The Script Include would do a GlideRecord on the list reference table to replicate the conditions you have now, pushing the results (group sys_ids) to an array, then another GlideRecord on the sys_user_grmember table to make an array of group sys_ids that the user is a member of.  Finally, use ArrayUtil to remove groups (sys_ids) from the first array that are present in the second array and return the results like

return 'sys_idIN' + finalArray.join(',');

https://docs.servicenow.com/bundle/vancouver-api-reference/page/app-store/dev_portal/API_reference/A... 

 

Hi Brad,

 

Thank You for the responce. 

We already have the script include that gets the list of groups and the existing groups of user whcih is called in the client script to display the groups based on the selection of request(to add groups or to remove).

Can you please help with the piece of code for reference.

 

Thank You!

I will try.  I'm not following what it is exactly that you don't yet have in place.  Maybe it would help to show what you do have working, then what is missing.

Hi Brad,

 

Thank You for your help! That worked!