cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
mikiepat
Helper III
Helper III

Allow created item to be approved automatically if approver creates item

Hi, I have created an Approval workflow in which an email goes to the selected approver once a SharePoint list item has been created. The problem is i don't want an approver to have to go through the approval process i.e. the approver created the item so the item should automatically get approved. Is there a way of doing this? thanks Mike
1 ACCEPTED SOLUTION

Accepted Solutions

Hi @mikiepat ,

Firstly, User().FullName is not Delegable, so you are better setting a Variable at App OnStart

 

Set(vUserName,User().FullName)

Second (may be a silly question), but I assume you are in the approvers list when testing this?
Assuming so, put a label on the screen with this

IsBlank(
   LookUp(
      POLogApprovers, 
      Approvers2 = vUserName, 
      Approvers2
   )
)

it should read false. If so, your formula should work, but I would make one change - I would put all this at App OnStart

Set(vUserName,User().FullName);
Set(
   vApprover,
   !IsBlank(
      LookUp(
         POLogApprovers, 
         Approvers2 = vUserName, 
         Approvers2
      )
   )
)

then your OnSuccess

If(
   !vApprover,
   ClickPowerAppsbuttontostartapprovalofSharePointitemsandsendemail.Run(
      POEditForm_New_PODetails.LastSubmit.ID
   )
)

Try the same logic on your status as well.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

7 REPLIES 7
WarrenBelz
Super User III
Super User III

Hi @mikiepat ,

I may be oversimplifying this, but you could test if the approver is the user and if so, do not trigger the Flow but simply add the approval fields. Happy to assist further.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Hi Warren,

 

Thanks for your reply - i'm not sure how i would do this. At the moment the flow is triggered by a button in a PowerApp and just runs every time the button is hit, regardless of who hits the button.

 

Have you got any examples on how this would work? I've done some googling but can't find anything on how i restrict a flow to run for specific users. I can identify the user from the createdby column in the associated SharePoint list or guess i could pick this up from within the App itself. By how do i, for example, identify that John Smith is an Approver and therefore the list fields - 'ApprovedBy' and 'ApprovedDate' be automatically populated with their name and today's date.

 

Do i need to identify they are an Approver before the Flow runs or integrate steps within the Flow to do this?

 

thanks

 

Mike

 

 

 

Hi @mikiepat ,

You can do it at the button level, so if your approver's name was in the list then

If(
  YourApproverField <> User().FullName,
  Run(YourFlow
)
  

of if you had a list of approvers in a list called Approvers in a field Approver then

If(
   IsBlank(  
      Lookup(
         Approvers,
         Approver = User().FullName,
         Approver
      )
   ),
   Run(YourFlow
)
  

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

 

 

Hi Warren,

Thanks again but i still cannot get your solution to work, this is what i have in the OnSuccess property of the form:

If( IsBlank( LookUp( POLogApprovers, Approvers2 = User().FullName, Approvers2 ) ), ClickPowerAppsbuttontostartapprovalofSharePointitemsandsendemail.Run(POEditForm_New_PODetails.LastSubmit.ID) )

I added the column Approvers2 to my Approvals list, which is a single line of text column, as the formula above was not working on the 'people or groups' column called Approvers - all that appears to have happened is that the = symbol is now underlined in blue instead of red.

I have also been struggling with data card values for Approvers, as i only want ApproveBy and ApprovedDate to be visible if the person editing the form is in the Approvers or Approvers2 column. The formula i have been using on the Visible property of these datacards is: If( IsBlank( LookUp( POLogApprovers, Approvers = User().FullName, Approvers ) ), true, false). However, they appear regardless of whether the form editor is an approver or not. 

Also i want the Status field to update to: Approved or Awaiting Approval depending on whether the form editor is an approver or not. The Update property if have tried on the status datacard is: 
If( IsBlank( LookUp( POLogApprovers, Approvers = User().FullName, Approvers ) ), ApprovedStatus,AwaitingApprovalStatus ).Approved Status and AwaitingApprovalStatus are text input controls. Unfortunately, this produces an error and the form submit fails.

Your help on this is much appreciated

Mike

 

 

Hi @mikiepat ,

Firstly, User().FullName is not Delegable, so you are better setting a Variable at App OnStart

 

Set(vUserName,User().FullName)

Second (may be a silly question), but I assume you are in the approvers list when testing this?
Assuming so, put a label on the screen with this

IsBlank(
   LookUp(
      POLogApprovers, 
      Approvers2 = vUserName, 
      Approvers2
   )
)

it should read false. If so, your formula should work, but I would make one change - I would put all this at App OnStart

Set(vUserName,User().FullName);
Set(
   vApprover,
   !IsBlank(
      LookUp(
         POLogApprovers, 
         Approvers2 = vUserName, 
         Approvers2
      )
   )
)

then your OnSuccess

If(
   !vApprover,
   ClickPowerAppsbuttontostartapprovalofSharePointitemsandsendemail.Run(
      POEditForm_New_PODetails.LastSubmit.ID
   )
)

Try the same logic on your status as well.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

Hi Warren,

Amazing!!! that works perfectly - thanks so much. You have saved me a lot of time head scratching.

I tried to accept this as solution but i'm getting a javascript error every time i click on the Accept as Solution. I'll try again tomorrow.

Thanks again!

Mike

 

Thanks @mikiepat ,

It is important to mark a solution that can help others and this one is quite interesting that your approach did not work.

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Did you miss the call? Check out the recording here!

Top Solution Authors
Top Kudoed Authors
Users online (2,457)