- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2024 07:58 AM - edited 11-06-2024 08:06 AM
Hi all,
I have seen a bunch of posts regarding this. However have not found any solution suitable to my needs.
Here is the situation:
1. I have a List Collector item in my Catalog item (accessed through the Service Portal). This item is a list of groups the user belongs to.
2. I need to get the name of the items to remove the groups that contain a certain phrase. For example: remove the user's association with the groups that contains the words "technician" in the group name.
3. So I need to get the names of the groups the user belongs to; not the id.
So i have tried the following to get the display name of this field - neither worked:
Any assistance would be highly appreciated.
Thanks,
M
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2024 12:39 PM
Since you've already made the trip to the server to get the group sys_ids, you could also get the group names at the same time to use for the name test and populating both list collectors with sys_ids.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2024 08:40 AM
You'll need to send the value of the list collector variable to a Script Include via GlideAjax. The Script Include will execute a GlideRecord on the list table with the query condition ('sys_id', 'IN', sysids) where sysids is a script variable assigned to the this.getParameter for the list collector value from the client script. For each record returned, either push the group.name (if the list field is sys_user_grmember) or name (if the list field is sys_user_group) to an array or test it against the certain phrase, depending on what you're trying to do. If you want the list collector variable value updated to not include any groups whose name contains a certain phrase, if the name test passes, push the value of the sys_id to an array, otherwise don't, then return the joined array and set the value of the list collector variable to the response from the SI. Give the scripts a shot and post them using the insert code icone </> if you get stuck.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2024 11:57 AM
Thanks. I was hoping for a more elegant way to do this.
M
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2024 12:23 PM
Do you need something to happen on the initial request form, as/after records are selected, or when viewing the RITM and the list collector variable is already populated, or after submitting the initial request, before the RITM is viewed?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2024 12:31 PM
The flow is this:
1. Service Portal Form is loaded - user select an employee (a Reference variable)
2. Client script pulls in all the groups the employee belongs to (I got to this point - I pulled all the sys_id of the groups this employee belongs to)
3. On the form there is a request to remove from - say remove from "Technician" or it could be "Manager".
4. So I now need to loop through all the groups this employee belongs to and identify which ones start with "Technician" and add them to the "Remove group from" (another List Collector variable) .
Thanks,
M