- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2018 09:09 AM
Hello - I am have a "user approval" activity in my catalog item's workflow and I want to use conditions to state who the approval should come from. I can script the conditions, but I don't know how to script the approval parts. It should look something like this:
If condition 1,
approval comes from person A
Else
approval comes from person B
The "approval comes from" part is what I don't know how to script. I don't know if I've explained this properly, so please let me know if additional information is needed. Thank you.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2018 11:57 AM
Hello John,
Use below code:
answer = [];
var mgr;
//Set manager to requested for if it's not empty, else set manager to requested by
if(!current.variables.u_requested_for) {
// check for the u_requested_for variable
//use either u_requested_for or requested_for
mgr = current.u_requested_for.manager;
}
else {
mgr = current.u_requested_by.manager;
}
answer.push(mgr);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2018 11:57 AM
Hello John,
Use below code:
answer = [];
var mgr;
//Set manager to requested for if it's not empty, else set manager to requested by
if(!current.variables.u_requested_for) {
// check for the u_requested_for variable
//use either u_requested_for or requested_for
mgr = current.u_requested_for.manager;
}
else {
mgr = current.u_requested_by.manager;
}
answer.push(mgr);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2018 01:05 PM
This code works as well, and it makes more sense to me so I will use this one. Thanks again!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2018 11:28 AM
Here you go use this
answer = [];
var mgr;
//Set manager to requested for if it's not empty, else set manager to requested by
if(current.variables.requested_for) { //assuming requested_for is a variable on the catalog item
mgr = current.u_requested_for.manager; //assuming u_requested_for is a field on the request item table
}
else {
mgr = current.u_requested_by.manager;
}
answer.push(mgr);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2018 11:34 AM
Thank you abhinay, you gave me the same solution as vidisha and it works. Vidisha just happened to chime in a minute before you 🙂 You've helped me 2x this week, very appreciative of your time!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2018 11:36 AM
But there is still error in your code
Instead of if(!!current.variables.requested_for)
It should be if(!current.variables.requested_for)