How to skip Ask for approval action based on condition in Flow designer

Sriharsha3
Tera Contributor

Hello

 

Im configuring a flow with some actions after appoval. I need to skip this approval if the requester is manger/ director etc. How can i add this on ask for approval action to skip and then perform action.

This can be done by an if condition, but it is duplicate work and needed a solution to fix this.

 

Thanks 

1 ACCEPTED SOLUTION

Ah okay.

Then why don't you create an after insert BR on sysapproval table and there you check 

the requested for is manager/director, if yes change the state to no longer required.

This way the control moves further.

Mark the comment as a correct answer and helpful if this helps to solve the problem.

View solution in original post

16 REPLIES 16

Hi,

The issue is when you use Ask for Approval it doesn't have any condition.

So you cannot make it conditional.

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Yes, trying to minimize the duplicate actions that needs to be created again. Yes, Thanks for the help.

Hi,

you can even avoid inserting the record into sysapproval_approver table if the condition doesn't match in that way no notification would be sent and no record would be created

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

asifnoor
Kilo Patron

Hi,

Add a if activity in the workflow and there you can check like this

answer = ifScript();
function ifScript() {
  //check here yoru conditions
  var user = gs.getUser().getUserByID(current.request.requested_for.toString());
  if(user.hasRole("manager") || user.hasRole("director")) {
    return 'yes';
  } else {
    return 'no';
  }
}

Link yes activity to the workflow.

Link no to link to the activity after approval.

Mark the comment as a correct answer and helpful if this helps to solve the problem.

Hi asif,

 

Not workflow, its for flow in flow designer.