Workflow Activity - Approval User - Advanced - BROKEN
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-15-2024 05:19 AM
Hi folks,
I noticed a very interesting behavior. Whenever we script out the list of approvers, we tick Advanced, correct. Here SNOW will suggest doing it like:
answer = [];
answer.push('id1');
answer.push('id2');
However, this is broken if we I am getting the approver from anything from the current.variable field of the RITM. For this to work, it has to be set like this:
answer = (function(current) {
var arr = [];
//set arr.push();
return arr
})(current);
So if the later code the best and and safest way to declare and script approvers?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-15-2024 07:37 AM
I use the suggested format exclusively, with success. How are you experiencing it 'broken' when using a variable value? Note that the variable should be a reference, or otherwise contain a sys_id as its value, and as a best practice / coding standard, ALWAYS force sys_ids to a string when pushing them to an array in any Javascript:
answer.push(current.variables.requested_for.toString());