diff --git a/Server-Side Components/Background Scripts/Retrieve MRVS Name and Value/RetrieveMRVSNameAndValue.js b/Server-Side Components/Background Scripts/Retrieve MRVS Name and Value/RetrieveMRVSNameAndValue.js new file mode 100644 index 0000000000..c385ee04ba --- /dev/null +++ b/Server-Side Components/Background Scripts/Retrieve MRVS Name and Value/RetrieveMRVSNameAndValue.js @@ -0,0 +1,23 @@ +//GlideRecord to the RITM table to access the name and corresponding value of MRVS +var getVariables = new GlideRecord('sc_req_item'); + +//Pass the sysId of RITM record +if (getVariables.get("")) { + + // is the internal name of MRVS + var mrvsInternalName = getVariables.variables.mobile_devices_set; + var rowsCount = mrvsInternalName.getRowCount(); + + if (rowsCount > 0) { + for (var i = 0; i < rowsCount; i++) { + var getRowVal = mrvsInternalName.getRow(i); + var getCellVal = getRowVal.getCells(); + + for (var j = 0, len = getCellVal.length; j < len; j++) { + var mrvsFieldName = getCellVal[j].getName(); + var mrvsFieldValue = getCellVal[j].getCellDisplayValue(); + gs.info(mrvsFieldName + ' : ' + mrvsFieldValue); + } + } + } +} diff --git a/Server-Side Components/Background Scripts/Retrieve MRVS Name and Value/readme.md b/Server-Side Components/Background Scripts/Retrieve MRVS Name and Value/readme.md new file mode 100644 index 0000000000..73b33a254b --- /dev/null +++ b/Server-Side Components/Background Scripts/Retrieve MRVS Name and Value/readme.md @@ -0,0 +1,18 @@ +This code comes handy to retrieve the name and value of Multi Row Variable Sets(MRVS). + +Sample: +RITM is raised with below MRVS details: + +image + + +Background Script: + +image + +Output: + +image + + +