
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2021 10:51 AM
Hello,
I have a catalog item where I have created a reference variable called "Requested by". If this field is the same user that the approval is going to I want the approval skipped.
How do I accomplish this?
Thank you in advance!
Joe
Solved! Go to Solution.
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2021 10:33 PM
You can use If activity with script just before your actual approval and return yes or no
if activity script
answer = ifScript();
function ifScript(){
// your logic to determine the approver here
var approver = 'your value';
if(current.request.requested_for == approver)
return 'no'; // output of this goes to next activity by skipping approval
else
return 'yes'; // output of this goes to approval activity
}
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2021 03:45 PM
Thanks Ankur,
We have a variable on the item called requested_by.
The approver(s) will come from a field called u_customer_approvers on the customer account form.
I tried the below and it did not work. It didnt throw an error, but it requests an approval even when 'requested_by' is the same person in the 'customer approvers' field.
answer = ifScript();
function ifScript(){
// your logic to determine the approver here
var approver = customer_account.u_customer.approvers;
if(current.variables.requested_by == approver)
return 'no'; // output of this goes to next activity by skipping approval
else
return 'yes'; // output of this goes to approval activity
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2021 10:09 PM
try to update as this
answer = ifScript();
function ifScript(){
// your logic to determine the approver here
var approver = customer_account.u_customer.approvers;
if(current.variables.requested_by == approver)
return 'no'; // output of this goes to next activity by skipping approval
else
return 'yes'; // output of this goes to approval activity
}
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2021 06:03 PM
Logic provided by
1) Check value current.variables.requested_by it will be sys_id if reference field, check value of approver is it sys_id?
2) Requsted By is available on Request form directly hence it is referred as
current.request.requested_for
but you are referring to variables -current.variables.requested_by which would have catalog item values
Please cross check it