- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2023 08:46 AM
Hello there!
I created two catalog items for the project I'm working on:
1. To add contacts.
2. To Request a Virtual Machine.
I need that when requesting item No. 1, you always need manager approval for this to proceed.
For item No. 2, that the approval is necessary only if it is the 2nd time that a VM is requested. (I already created a variable in the catalog item that asks if it is the 1st or 2nd request).
I understand that for this I must use Workflows, but I'm not very familiar with the subject.
Any help is greatly appreciated!
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2023 10:45 AM
Hi @Asosa ,
you don't have to ask on the UI (users might say 1 all the time), handle it through the workflow
in you workflow (if your using workflow ), have a if workflow activity
sample script
answer = (function(){
var req = new GlideRecord("sc_req_item");
req.addQuery("cat_item", "sys_id of the catalog item"); //update the sys_id of the catalog item
req.addQuery("requested_for", current.requested_for) //check for same requestor
req.addQuery("sys_id" "!=", current.sys_id) //exclude the curernt request
req.addQuery("state" "!=" "4") //not closed incomplete
req.query();
if(req.next()){
return 'yes';
}
return 'no';
})();
if yes , route to approval block, if no skip the approval block.
let me know if any questions.
Thank you,
Hemanth
Certified Technical Architect (CTA), ServiceNow MVP 2024, 2025

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2023 10:45 AM
Hi @Asosa ,
you don't have to ask on the UI (users might say 1 all the time), handle it through the workflow
in you workflow (if your using workflow ), have a if workflow activity
sample script
answer = (function(){
var req = new GlideRecord("sc_req_item");
req.addQuery("cat_item", "sys_id of the catalog item"); //update the sys_id of the catalog item
req.addQuery("requested_for", current.requested_for) //check for same requestor
req.addQuery("sys_id" "!=", current.sys_id) //exclude the curernt request
req.addQuery("state" "!=" "4") //not closed incomplete
req.query();
if(req.next()){
return 'yes';
}
return 'no';
})();
if yes , route to approval block, if no skip the approval block.
let me know if any questions.
Thank you,
Hemanth
Certified Technical Architect (CTA), ServiceNow MVP 2024, 2025

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2023 10:00 AM
Hi @Asosa ,
did this help, if so.
Thank you,
Hemanth
Certified Technical Architect (CTA), ServiceNow MVP 2024, 2025