How to get the value of the variable in request item
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2024 07:42 PM
How can I get the value of the variable in the multi-row in the variable set in request item, I used
variables.<variables set name>
but there is an error like this.
Thanks in advance!
5 REPLIES 5
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2024 10:47 PM
I have tried the below in background script:
var itemID = '376adcdc1baa8a905c8bea88b04bcb3f'; //sysID of RITM
var ritmGR = new GlideRecord('sc_req_item');
//You have to add your query according to your requirement
if (ritmGR.get(itemID)) {
var mrvsData = ritmGR.variables.service_agent_amendment.toString(); //Accessing the mrvs
var typeVariable = ritmGR.variables.project_name; //accessing the variable of the catalog item
var mrvsVal = JSON.parse(mrvsData);
for (var i = 0; i < mrvsVal.length; i++) {
var var1 = mrvsVal[i].saa_project_name; //access the mrvs variable 1
var var2 = mrvsVal[i].service_agent_type; //access the mrvs variable 2
}
}
if(typeVariable == var2){
//Match found, return accordingly
gs.info('Test');
}
----------------------------------------------------------------
Mark this as Helpful / Accept the Solution if this helps.
Mark this as Helpful / Accept the Solution if this helps.