- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-29-2023 08:14 AM
Hello I am having an issue on my catalog item where when the data in the list collector shows on the catalog item in the portal view,
but when I submit the record the ritm shows the value as blank.
I did notice when I try the item in the native view the list collector doesnt populate. I have a client script and a script include that are suppose to populate the list collector with the groups the user in the reference field is in but for some reason it isnt saving and im not seeing why. below is the scripts:
Client script is on change of the user field:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var gajax = new GlideAjax('GroupsMembership');
gajax.addParam('sysparm_name','getGroups');
gajax.addParam('sysparm_userID', newValue);
gajax.getXML(getResults);
}
function getResults(response){
var answer = response.responseXML.documentElement.getAttribute("answer");
g_form.setValue('remove_group', answer);
}
Here is the script include:
var GroupsMembership = Class.create();
GroupsMembership.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getGroups: function() {
var groups = [];
var user = this.getParameter('sysparm_userID');
var gr = new GlideRecord('sys_user_grmember');
gr.addQuery('user', user);
gr.addEncodedQuery('group.parent=148b7f921ba874100888ed7bbc4bcbba');
gr.query();
while (gr.next()) {
groups.push(gr.group.getDisplayValue());
}
return groups.toString();
},
type: 'GroupsMembership'
});
Any assistance would be greatly appreciated
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-29-2023 01:21 PM
I was able to solve this issue. In the script include
groups.push(gr.group.getDisplayValue());
was causing the problem. I changed it to
groups.push(gr.group.getValue());
and it works fine now.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-29-2023 10:04 AM
So what are the variables set to by definition, and what are your UI policies doing? Do you have anything else clearing or moving the data? You provided the scripts, but those are just setting the values. We would need to know some of these specifics to understand what is happening.
If it is just UI policies (aside from populating with a script include), generally I use a pair of policies on variables - one for the Service Portal, and one for RITM/SC Task.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-29-2023 10:16 AM
I dont think that is where the issue lies but I may be wrong, When I go into the catalog item in the native view and try to submit. I get the same issue where the values show as none.
The ui Polices simple show/hide the fields depending on the selected option and make the list collector read only. As a test I just unchecked the ui policies to run on the requested item and I still have the same issue

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-29-2023 10:20 AM
I might be confused by what you're saying the issue is...
Are you saying that no values are being displayed in the catalog item when submitting from the platform, and not the Service Portal
OR
The variables listed on the RITM are not getting moved from the catalog item submission TO the RITM record?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-29-2023 10:23 AM
Basically the only place it is working correctly is in the portal. on the catalog item when submitting in the native view and on the RITM record the list collector shows no values. but in the portal it populates correctly with the users groups when you select a user in the above reference field.
I should've also mentioned I made sure the client script is set to run in all UI Types
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-29-2023 01:21 PM
I was able to solve this issue. In the script include
groups.push(gr.group.getDisplayValue());
was causing the problem. I changed it to
groups.push(gr.group.getValue());
and it works fine now.