I've a requirement to trigger the task when a variable - 'ABCD' is '1','2','3','4'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā08-23-2024 12:18 AM
I've a requirement to trigger the task when a variable 'ABCD' is '1','2','3','4' .Where ABCD variable is a 'LookUp Select Box' and Its declared with in the MRVS Variable set
Please help me how to write a script to access this variable in the workflow If condition .That would help me trigger the task.
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā08-23-2024 01:35 AM
Sample Script:
You can use a Script in the Flow Designerās If condition as follows:
// Assuming 'current' is the GlideRecord of the task or record you are working with
var mrvs = current.variables.multi_row_variable_set_name; // Replace with your MRVS name
var triggerTask = false;
mrvs.forEach(function(row) {
var abcdValue = row.variables.ABCD;
if (abcdValue == '1' || abcdValue == '2' || abcdValue == '3' || abcdValue == '4') {
triggerTask = true;
}
});
triggerTask; // This will return true if any row has the desired value, triggering the task
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā08-23-2024 01:54 AM
I 've tried this but it's not working in the if condition
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā08-23-2024 02:05 AM
Added consideration and break for NULL.
var mrvs = current.variables.multi_row_variable_set_name;
var triggerTask = false;
mrvs.forEach(function(row) {
var abcdValue = row.variables.ABCD;
if (abcdValue !== null && typeof abcdValue === 'string' &&
(abcdValue === '1' || abcdValue === '2' || abcdValue === '3' || abcdValue === '4')) {
triggerTask = true;
break; // Break the loop if a condition is met
}
});
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā08-23-2024 06:23 AM
did not work