How to get the MVRS details from sc_req_item using script ?

String
Kilo Sage

Hi Team ,

Am trying to get the catalog item details from the  sc_req_item and am able to get the variables but unable to get the MVRS details ,Please guide me 

am using the below code 

 

 

var pageRecords = [];

 var grRequestedItem = new GlideRecord('sc_req_item');

    grRequestedItem.orderByDesc('sys_created_on');

grRequestedItem.query();

while (grRequestedItem.next()) {

var resJSON = {

            case: grRequestedItem.request.parent.getDisplayValue(),

            number: grRequestedItem.getValue('number'),

};

if(grRequestedItem.getDisplayValue(‘MVRS')){

gs.info(grRequestedItem.getDisplayValue(‘MVRS));//am not getting the MVRS details 

}

for (var prop in grRequestedItem.variables) {

  if (grRequestedItem.variables[prop] != '') {

var variable = grRequestedItem.variables[prop].getDisplayValue();

                for (var i = 0; i < toDelete.length; i++) {

                    delete resJSON[toDelete[i]];

                    resJSON[prop] = variable;

                }}}

pageRecords.push(resJSON);
}

response.setBody(pageRecords);

   

String_0-1693479501066.png

 

 

please guide me

1 ACCEPTED SOLUTION

@String 

syntax to get MRVS json is this

grRequestedItem.variables.MVRSVariableSetName

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

View solution in original post

5 REPLIES 5

@String 

syntax to get MRVS json is this

grRequestedItem.variables.MVRSVariableSetName

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