Bypass Approval
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2022 12:17 AM
We have a Catalog Item, its an Access request form , when an organization Directors submit the request it should bypass(Skip) the VP and above level approval, please help me on this
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2022 01:17 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2022 01:19 AM
My Requirement is when a Request is submitted in the Catalog form by a Director it should not go to the VP & Above approval, and also REQ and RITM is created but the Task is not created please help me on that
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2022 01:31 AM
You need to modify your IF Block script as below:
In the screenshot above, Requestor is a Variable which is present on the form or not? Can you confirm this?
if it is present then use the script below:
answer = ifScript();
function ifScript(){
var getRequestedFor = current.variables.VariableName; // Replace "VariableName" with Requested for variable on your catalog item
var getTitle = validateTitle(getRequestedFor.toString());
if(getTitle == 'Title1' || getTitle == 'Title2' || getTitle == 'Title3'){
return 'yes';
}else{
return 'no'
}
}
function validateTitle(getRequestedFor){
var gr = new GlideRecord('sys_user');
gr.addQuery('sys_id',getRequestedFor);
gr.query();
if(gr.next()){
return gr.title.toString();
}
}
This should work for you to bypass the approval.
In case if you want to check Requested for present on Request Table and then Bypass it then use the script version below:
answer = ifScript();
function ifScript(){
var getRequestedFor = current.request.requested_for;
var getTitle = validateTitle(getRequestedFor.toString());
if(getTitle == 'Title1' || getTitle == 'Title2' || getTitle == 'Title3'){
return 'yes';
}else{
return 'no'
}
}
function validateTitle(getRequestedFor){
var gr = new GlideRecord('sys_user');
gr.addQuery('sys_id',getRequestedFor);
gr.query();
if(gr.next()){
return gr.title.toString();
}
}
Hope this helps. Please mark the answer as correct/helpful based on impact.
Regards,
Shloke
Regards,
Shloke
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2022 02:36 AM
Sorry by mistake i have deleted your Script, could you please send me again
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2022 03:14 AM
Ahh. I have to rewrite it again.
Posting it again, try it and let me know what issues you are facing:
The Script which you shared in this post before deleting it, I saw an Requested For being validated in your Script.
So two things, can you confirm if Requested For is a Variable on your catalog form or not? If it is a Variable on the form then you need to use below script for checking the title of Requested for and deciding it the user is a Organization head or not. Please use below Script in your IF Activity block in your workflow:
answer = ifScript();
function ifScript(){
var getRequestedFor = current.variables.VariableName.toString(); // Replace "VariableName" with Requested for Variable name
var checkTitle = getTitle(getRequestedFor);
if(checkTitle == 'Tilte 1' || checkTitle == 'Tilte 2 || checkTitle == 'Tilte 3' ||){
return 'yes';
}else{
return 'no';
}
}
function getTitle(getRequestedFor){
var gr = new GlideRecord('sys_user');
gr.addQuery('sys_id',getRequestedFor);
gr.query();
if(gr.next()){
return gr.title.toString();
}
}
Else if you want to check Requested for value from Request(sc_request) table then use the below version of script instead of above:
answer = ifScript();
function ifScript(){
var getRequestedFor = current.request.requested_for.toString();
var checkTitle = getTitle(getRequestedFor);
if(checkTitle == 'Tilte 1' || checkTitle == 'Tilte 2 || checkTitle == 'Tilte 3' ||){
return 'yes';
}else{
return 'no';
}
}
function getTitle(getRequestedFor){
var gr = new GlideRecord('sys_user');
gr.addQuery('sys_id',getRequestedFor);
gr.query();
if(gr.next()){
return gr.title.toString();
}
}
This should check for you and allow you to bypass Approval for the title you want.
Hope this helps. Please mark the answer as correct/helpful based on impact.
Regards,
Shloke
Regards,
Shloke