The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Multi Row Variable set values to show on updated catalog item

Vignesh21
Kilo Guru

Hi All,

 

I have a requirement where i have to pull the values entered in the multi Row Variable set on another catalog item.

 

Example: Catalog Item A - Already submitted values into variable set

Catalog Item A .jpg

 

 

Example: Catalog Item B - User will enter the RITM in Requested item variable. Once updated it should pull value from RITM0010002, and populate in  MRVS - Additional Information. 

 

Catalog Item B - Pull value from RITM variable set and populate .jpg

 

 

I tried checking in the community could not find the right solution. Is there a way we could pull the data from

sc_multi_row_question_answer table and populate.
 
Thanks,
 
1 REPLY 1

Ankur Bawiskar
Tera Patron
Tera Patron

@Vignesh21 

Simply use onChange + GlideAjax, get the MRVS JSON from earlier RITM and set it

Something like this, but please enhance

Script Include: It should be client callable

var MRVSHelper = Class.create();
MRVSHelper.prototype = Object.extendsObject(AbstractAjaxProcessor, {

    getMRVSValues: function() {
        var gr = new GlideRecord("sc_req_item");
        gr.addQuery("sys_id", this.getParameter('sysparm_ritmSysId'));
        gr.query();
        if (gr.next()) {
            return gr.mrvsVariableSetName.toString();
        }
    },

    type: 'MRVSHelper'
});

onChange Catalog client script: on RITM variable

function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading) {
        return;
    }

    if (newValue === '')
        g_form.clearValue('mrvsVariableSetName');

    var ga = new GlideAjax('MRVSHelper');
    ga.addParam('sysparm_name', 'getMRVSValues');
    ga.addParam('sysparm_ritmSysId', newValue);
    ga.getXMLAnswer(function(response) {
        g_form.setValue('mrvsVariableSetName', response);
    });
}

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader