How to trigger if condition in the workflow based on check box value in MRVS
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2025 06:49 AM
Hi all.
We have a requirement to trigger if condition based on the Variable values in the MRVS.
Multi Row variable set name : Configuration items
There are two check boxes in the variable set named Requirement and Replace.
I need to trigger workflow if the Requirement is marked as True it should be routed to Yes and if Replace is marked as True then it should move to No.
Can anyone please help me with the syntax on how to acheive this.
Thank you,
Balaram.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2025 07:27 AM - edited 01-22-2025 07:40 AM
Hi @Balaram7
You can try below code
I have tried it in background script its working for me you can try it in workflow
// Access the MRVS variable set
var mrvs = current.variables.configuration_items.toString();
gs.print("MRVS "+ mrvs);
//To fetch multirow variable set row number
var count=current.variables.configuration_items.getRowCount();
gs.print("MRVS rows "+ count);
var routeToYes = false;
var routeToNo = false;
// Loop through the MRVS rows and check checkbox values
//if in any row requirement is selected as true then routeToYes will be true and same for replace
for (var i = 0; i < count; i++) {
var requirement =current.variables.configuration_items["requirement"][i]; // Checkbox for Requirement
var replace =current.variables.configuration_items["replace"][i]; // Checkbox for Replace
if (requirement == true) {
routeToYes = true;
}
if (replace == true) {
routeToNo = true;
}
}
If my response really helped you then please mark it helpful.
Thanks & Regards,
Sejal
Thanks & Regards
Sejal Chavan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-23-2025 05:09 AM
Hi @sejal1107,
I tried this code unfortunately, this is not working. Could you please suggest any changes needs to be done.
Thank you,
Balaram.