List collector values not saving to RITM record

dagarson
Tera Guru

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, 

dagarson_0-1680102466492.png

but when I submit the record the ritm shows the value as blank.

dagarson_1-1680102559449.png

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

1 ACCEPTED SOLUTION

dagarson
Tera Guru

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.

View solution in original post

9 REPLIES 9

Marcus Walbridg
Tera Expert

Do you have any UI policies that are clearing the variables for RITM's/SC Tasks?

No, hiding but not clearing

Based on the screenshot you posted, it's not hidden either

Its hidden if you were to "select an option" different than the remove