If requester is approver
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2024 12:32 AM
Hi Community,
There is one catalog item in which requester is approver can we auto-approver this approver in workflow.
Thanks in advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2024 01:09 AM
Hi @sandeshraut198 ,
I hope the catalog item will have a workflow associated to it... So in the approval activity you can create a script conditon to check if the requested for is same as approver or part of approval group. If yes the you can mark the state as approved if not then to requested state.
Ex:
answer = ifScript();
function ifScript() {
var count = 0;
var grg = new GlideRecord('sys_user_grmember');
grg.addEncodedQuery('Group SysID');
grg.query();
while (grg.next()) {
if (grg.user.toString() == current.request.opened_by.toString()) {
count++;
}
}
if (count > 0) {
return 'yes';
} else {
return 'no';
}
}
☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2024 01:20 AM - edited 03-12-2024 01:20 AM
Hello @sandeshraut198 , Please refer below images for your reference. It is working in my instance. If I am correctly understand your question, it might be help you.
Workflow activities:
Script added in the highlighted "If" activity:
Thank You!!
Thank you!!
Dnyaneshwaree Satpute
Tera Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2024 01:23 AM
Shouldn't you make it that in this case the submitter can't approve it's own request? The approval process is there so someone with decision privileges can decide if someone else is eligible for what he is requesting. Just because you are given the privilege of approving it for others, doesn't make you eligible. Audit wise, approving your own request is a no-go.
Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2024 03:12 AM
Hi Mark,
For example, for UK customer, XYZ is the HR representative who approves all the "catalog item name", however he is usually also the one raising these requests herself. Can we automate it somehow so that he would not have to approve her own request?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-13-2024 12:15 AM
Yes, you can. Just put a validation in there that if the approval is for catalog item 'X' and the requested by is also the approver (but not the requested for), it get's approved. It would be easy in a flow, but in a workflow it can be done as well. You already received some answers on how to, but just make sure you are covered that someone does not approve for him/herself.
Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark
