list collector not working in If condition activity in workflow when selects multiple values
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-30-2024 09:20 AM
Hello All,
When I am trying the add if condition and getting exact match then it is working. If it not having exact match then it is not working even the value is present the if condition.
For example: when i am selecting in portal product_type is empty and oA is different sys_id and 556dfc028722021441377446dabb35ab. Then the return is getting no. but the condition is met it should goto yes flow.
Could anyone please help on this issue.
Script is below:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-30-2024 09:32 AM
With your approach to creating arrays you are likely getting one concatenated array containing two elements instead of many elements from each list collector variable and/or by returning 'no' in the GR while loop you are only testing only the first record in the array.
var product_type = current.variables.product_type.toString().split(',');
var oA = current.variables.operational_or_administrative_expense_indirects.toString().split(',');
var tabs_array_pt = product_type.concat(oA);
// Logging the result
gs.info("Concatenated Array third element: " + tabs_array_pt[2]);
for (var i in tabs_array_pt) {
var gr1 = new GlideRecord('u_catalog_data_lookup');
gr1.addQuery('sys_id', tabs_array_pt[i]);
gr1.query();
while (gr1.next()) {
if (gr1.u_value == 'product_type_fertilizer' || gr1.u_value == 'product_type_other_merchandise' || gr1.u_value == 'product_type_raw_materials_manufacturing' || gr1.u_value == 'product_type_seed' || oA.indexOf('556dfc028722021441377446dabb35ab') != -1) {
return 'yes';
}
}
i++;
gs.info('Merged the both: ' + i++);
}
return 'no';