- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-15-2023 04:02 AM
HI,
i have created a catalog item and user MRVS in that, there are 2 fields in multi row
request_type = action and deletion
association = Non government and government
Now i want a condition to check if request type is action or deletion && association is No government then its Yes otherwise No
I tried to write MRVS script but not working
Multi row variable set internal name: declaration_list
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-16-2023 06:47 AM
you didn't answer my above question
are you saying if any 1 row satisfies that condition then you want to return yes or all rows should satisfy that condition?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-15-2023 04:49 AM
Can you please help in the script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-15-2023 05:15 AM
you need to parse and check the json value
are you saying if any 1 row satisfies that condition then you want to return yes or all rows should satisfy that condition?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-15-2023 05:28 AM
Below script is the normal if condition and i want same but variables are in MRVS
answer = ifScript();
function ifScript() {
if (current.variables.declaration_type == 'Gift' || current.variables.declaration_type == 'Hospitality' && current.variables.associate == 'Non Government Official') {
return 'yes';
} else {
return 'no';
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-16-2023 06:33 AM
I have written the if script in workflow with below code, But it is always taking to No condition, Also when i tested with background with script it is coming Yes but dont no why No in workflow
function ifScript() {
var multiRowVarSet = current.variables.declaration; // variable set internal name
var rowCount = multiRowVarSet.getRowCount();
for (var i = 0; i < rowCount; i++) {
var row = multiRowVarSet.getRow(i);
var declarationType = row.declaration_type;
var associate = row.associate;
if (declarationType == 'Gift' || (declarationType == 'Hospitality' && associate == 'Non Government ')) {
return 'yes';
}
return 'no';
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-16-2023 06:47 AM
you didn't answer my above question
are you saying if any 1 row satisfies that condition then you want to return yes or all rows should satisfy that condition?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader