cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper I
Helper I

Exclude an Approver if they are the Submitter (Requester)

Hi, 

 

Please note that I have a flow that has 4 approvers and usually one of them is requesting the form for approvers.  I want to exclude the requester from approving this form since his approval is inherited and no need to approver from his side.

 

I need this to be dynamically done. 

 

I am using "when the item is created", "initializing variables, then it will go for approvers "start and wait for approval (all must approve)".  I think the step of excluding the approver should come before the start and wait for approval (all must approve). 

 

I appreciate your help with this issue. 

 

Thanks. 

 

Waleed. 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Helper I
Helper I

Re: Exclude an Approver if they are the Submitter (Requester)

Thanks Scott. 

 

It is working now, I re-arranged the emails!!

 

Once again thanks for your support.

 

Waleed

View solution in original post

17 REPLIES 17
Highlighted
Super User
Super User

Re: Exclude an Approver if they are the Submitter (Requester)

@WK-PA2020 

Please see my screen shots below.   I populate an array with the names of all approvers.  Then I loop through the array and compare the created by email to the array element.  Please note that Flow is case sensitive - be sure the enter the email addresses with that in mind or your condition won't work properly.

image.png

image.png

image.png

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott
Highlighted
Helper I
Helper I

Re: Exclude an Approver if they are the Submitter (Requester)

Hi Scott, 

 

Shall I include all the emails in the initialize variable (all approvers) in the value place?

 

Please note that I already have an Initialize variable to get all responses!  (after when item is created).  Is this affecting your steps?

 

Thanks. 

 

Highlighted
Super User
Super User

Re: Exclude an Approver if they are the Submitter (Requester)

@WK-PA2020 

All approvers should be included in the array.  My loop adds approvers to the string variable only if they are not the creator of the item.

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott
Highlighted
Helper I
Helper I

Re: Exclude an Approver if they are the Submitter (Requester)

Hi Scott, 

 

I put the emails in the value as: 

"wwwww@nnnnnnn.com",

"kkkkkkk@nnnnnnn.com"

 

I received the below message and the flow failed:

 

The variable 'VarApprovers' of type 'Array' cannot be initialized or updated with value '"         @           com"
" @     .com"' of type 'String'. The variable 'VarApprovers' only supports values of types 'Array'.

 

Thanks. 

 

Waleed

Highlighted
Helper I
Helper I

Re: Exclude an Approver if they are the Submitter (Requester)

May I should include: 

 

]

 

[

 

 

Highlighted
Helper I
Helper I

Re: Exclude an Approver if they are the Submitter (Requester)

Hi Scott, 

 

I put 3 emails and one of them to the requester but it failed and gave the below message, but before a few minutes I tried 2 emails one of them for me and it is succeeded!

 

The variable 'VarApprovers' of type 'Array' cannot be initialized or updated with value '[
"         @      .com",
"         @              .com",
"         @    .com",
]' of type 'String'. The variable 'VarApprovers' only supports values of types 'Array'.

 

Thanks, 

 

Waleed

Highlighted
Super User
Super User

Re: Exclude an Approver if they are the Submitter (Requester)

@WK-PA2020 

I believe that removing the last comma in your array will resolve your issue.  The comma separates elements of the array and should not be included after the last element.

 

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott
Highlighted
Helper I
Helper I

Re: Exclude an Approver if they are the Submitter (Requester)

I amended the emails and removed ( , ) from the last email in the end and now it gives me the below message: 

 

"There's an error in your flow preventing the creation of Approvals. Use the link below to learn more about the errors with your flow and/or environment configuration."

 

And in the Start and wait for approval is giving the below message: 

BadRequest. The request failed. Error code: 'InvalidApprovalCreateRequestAssignedToNoValidUsers'. Error Message: 'Required field 'assignedTo' contained no valid users in the organization'.

 

Thanks.

Highlighted
Helper I
Helper I

Re: Exclude an Approver if they are the Submitter (Requester)

Hi Scott, 

 

When I remove the 3rd email it is working and the fill as follows: 

 

[
"            @       .com",
"            @       .com
]

Highlighted
Helper I
Helper I

Re: Exclude an Approver if they are the Submitter (Requester)

I removed the comma (,) and now giving me another message:

 

There's an error in your flow preventing the creation of Approvals. Use the link below to learn more about the errors with your flow and/or environment configuration.

 

And in the Start and wait for approval is giving the below message: 

BadRequest. The request failed. Error code: 'InvalidApprovalCreateRequestAssignedToNoValidUsers'. Error Message: 'Required field 'assignedTo' contained no valid users in the organization'.

 

Thanks. 

Highlighted
Super User
Super User

Re: Exclude an Approver if they are the Submitter (Requester)

@WK-PA2020 

It sounds as though none of the approvers were added to your string.  Take a look at your run to verify.  Refer to my example above which works.

 

 

 

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott
Highlighted
Helper I
Helper I

Re: Exclude an Approver if they are the Submitter (Requester)

Hi Scott, 

 

This is the solution as per PA but still, I cannot determine the solution. 

 

Thanks.  

Highlighted
Helper I
Helper I

Re: Exclude an Approver if they are the Submitter (Requester)

Thanks Scott. 

 

It is working now, I re-arranged the emails!!

 

Once again thanks for your support.

 

Waleed

View solution in original post

Highlighted
Helper I
Helper I

Re: Exclude an Approver if they are the Submitter (Requester)

Hi Scott, 

 

Is it ok to put 3 emails or more in the initialize Variables?  Actually I am doing 3 emails but it is giving the same message and error that the emails not found but when I try 2 of them it is working!!

 

Thanks. 

Highlighted
Super User
Super User

Re: Exclude an Approver if they are the Submitter (Requester)

@WK-PA2020 

You can add as many approvers as you would like.  Please post an updated screen shot of your Flow if you need help.

 

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott
Highlighted
Helper I
Helper I

Re: Exclude an Approver if they are the Submitter (Requester)

Hi Scott, 

 

I have 2 approvers in addition to me, for 3 of us it is not working and I am the requester!  In case I put my self and one of them it is working and correctly ignoring me as I am the requester and that means the error that the user is invalid and not found in the organization is wrong. 

 

I rearranged the emails in initialize Variables but without no hope but earlier it succeeded!

 

Really I do not know what is the problem. 

 

Thanks, 

Highlighted
Helper I
Helper I

Re: Exclude an Approver if they are the Submitter (Requester)

Hi, 

 

Any help on this issue? 

 

Thanks, 

 

Waleed

Helpful resources

Announcements
firstImage

Now Live: Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

Top Solution Authors
Top Kudoed Authors
Users online (10,721)