How to get variable values from Multirow variable set
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2024 10:34 PM
Hello,
There are two multirow variable sets and i want to retrieve some variables value from one multi row variable set and some are from second multirow variable set. And need to store those two variable set value in json object in one workflow scratchpad.
Thanks,
3 REPLIES 3
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2024 10:48 PM
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2024 11:13 PM
Hello @YashviPatil ,
Please find the below code modify it according.
// to get content of mrvs
var jsonObj = JSON.parse(mrvs);
var userList = [];
for (var i=0; i< jsonObj.length; i++) {
userList.push(jsonObj[i].user_name.toString()); // instead or user_name give your field name from mrvs
}
var obj = {};
obj.multiCategory = userList.join(',').toString(); // storing it in the object and you can call it in workflow
result.push(obj);
gs.info(result[0].multiCategory);
Thank you,
Omkar
If I was able to help you with your case, please click the Thumb Icon and mark as Correct.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2024 11:17 PM
@YashviPatil
same sample code.
var gr = new GlideRecord('sc_req_item');
gr.get('04ad95e647528210ea269dbe316d43af');
var mrvs = gr.variables.xxxxxx; //your MRVS name
var rowCount = mrvs.getRowCount();
for (var i = 0; i < rowCount; i++) {
var row = mrvs.getRow(i);
var xyz = row.ttttt //your MRV field name
row.ttttttt = "Dell 17 inch Monitor" + i; //modify
//...
}
Please mark my answer as correct and helpful based on Impact.