cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
GaryDev
Level: Powered On

Approval Flow Fails If Comments Are Empty

I have created a flow that has approval requests in them.

 

Inside the flow is a condition that if the first line of approvals contains the name of a senior manager here it will trigger another approval run that requires him to approve the new entry of the spreadsheet. The idea is that if those comments don't contain that name or are empty then it should run the 'no' arm of the condition.

 

Unfortunately if the comments are empty the condition fails and causes the no arm (and therefore the remainder of the flow) to fail. If, however, you put ANYTHING in the comments then the flow will continue.

 

Ideally I would like it so the comments can be left blank if necessary.

 

Does anyone have any tips please?

6 REPLIES 6
Super User
Super User

Re: Approval Flow Fails If Comments Are Empty

Can you upload a screen shot of the run history failing?

GaryDev
Level: Powered On

Re: Approval Flow Fails If Comments Are Empty

Hi Pieter, 

 

I've tried to upload the photo here but must be some issue with our security settings. I've uploaded them to google drives so please feel free to have a look. 

 

I've included the failure report as well as some images of the flow itself. 

 

Gallery of flow images

Super User
Super User

Re: Approval Flow Fails If Comments Are Empty

I've not fully tested it, but I think I undertsna the problem.

 

The contition is checking 

 

null contains xyz

 

this is not valid.

 

Can you put the comment in a coalesce function

 

coalesce(<Your dynamic content>,'unknown')  

 

this will set the left hand side of the condition to unknown if the dynamic content is empty.

 

GaryDev
Level: Powered On

Re: Approval Flow Fails If Comments Are Empty

Hi Pieter,

 

It should be testing like this (I've put it in to a bit of code to see if that helps)

 

if (approval response comments = 'Simon') {

     send approval request to recipient 'Simon'

           if (simon response = approve) {

                run apply to each 3

                    }

              }

else {

run apply to each 4

}

 

This is what I was hoping the condition would do. It does do this but only if there's any kind of comment in the initial responses.

 

With that in mind would your intial suggestion still work?

 

 

 

 

 

Super User
Super User

Re: Approval Flow Fails If Comments Are Empty

In your above logic, it looks like 

 

 if (simon response = approve) { ...

 

is compairing the invalid stuff. So you will need to include the coalesce here. 

 

So somthing like this:

coalesce(simon response, 'unknown') = 'approve'

 

If somin's response is now empty you will get 'unknown' = 'approve' being returened as false. When the response is not empty you will get the response being compared with approve.

GaryDev
Level: Powered On

Re: Approval Flow Fails If Comments Are Empty

Ah I understand where we have our wires crossed.

 

The part of the flow you're referring to works.

 

The bit that doesn't work is the condition above it which should be

 

if the initial approval comments contains the word 'Simon' then run the yes arm. If it contains null or anything else then run the no arm.

 

Once it gets to Simon it works every time!

Helpful resources

Announcements
firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 Release Wave 2 Plan

Power Platform 2019 Release Wave 2 Plan

Features releasing from October 2019 through March 2020

thirdimage

Flow Community User Group Member Badge

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

fifthimage

Microsoft Learn

Learn how to build the business apps that you need

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Flow Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 242 members 5,182 guests
Please welcome our newest community members: