Approval based on variable contains
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-13-2023 01:57 AM
Hi,
I have a reference variable that has the reference of 'Business Unit' table.
I want the approval to go based on the Business unit contains, but it's not working for me.
In the User approval activity I am using advanced.
var answer = [];
if (current.variables.business_unit.indexOf("abc") > -1) {
answer.push(gs.getProperty('approval.one'));
} else {
answer.push(gs.getProperty('approval.two'));
}
Kindly assist
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-13-2023 08:41 AM
oh yes, I am sorry. can you keep '-1' in quotes and try once.
If my answer solved your issue, please mark my answer as ✅Correct & 👍Helpful
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-13-2023 09:18 AM - edited 03-13-2023 09:19 AM
var answer = [];
if (current.variables.business_unit.getDisplayValue().indexOf("abc") > -1) {
answer.push(gs.getProperty('approval.one'));
gs.log("Business: " + current.variables.business_unit.getDisplayValue().indexOf("abc") > -1);
//gs.log("Approver One: " + answer);
} else {
answer.push(gs.getProperty('approval.two'));
//gs.log("Approver Two: " + answer);
gs.log("Businesssss: " + current.variables.business_unit.getDisplayValue().indexOf("abc") > -1);
}
I have added it and in the log it is coming as false
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2025 02:11 AM
Hope you are doing good.
Did my reply answer your question?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader