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

Handling non-existant properties?

Very new to Flow and hope I just missing something basic here. 

 

I designed a Flow to send an email notification to users with a list of items from a SharePoint library.

 

Flow_1.png

 

In the Select action I am selecting the fields from the Filter that I want to send but the issue is that if the column is blank in SharePoint.  The Flow fails with a message that the Property does not exist. The field I'm using is a Choice column with a blank default value.

 

Flow_2.png

 

I spent a couple days coming up with a solution that creates an array from the items, iterates through array and checks each item to see if the property exists.  Adds a default missing property and then updates the array with the information. It seems to work as I need, but just seems overly complicated for something as simple as checking the property exists and using a default value if it doesn't.

 

Flow_3.png

 

I tried a lot of different things based on other forum posts, web searches and the MS Flow documentation.  So far this is the only way I can get it to work.  I just wondering if I am missing something easy to handle this instead of adding so many additional actions to the flow.  I actually need to handle 5 fields that may be blank and this seems overly complicated.  It seems like there should be an @exists function or something like that to trap the error. Alternatively I suppose I could force the SharePoint library to not allow blanks but that is changing the functionality of the library that the end users are used to.

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Handling non-existant properties?

Hi @howitzer1972,

 

Yes, it is a default behavior for action Select, any blank value won’t be allowed for the value. All the columns must contain value when using action Select.

 

While we could use a function to return a blank value depends on the situation.

 

For the Choice column, please try the following code:

if(empty(item()?['Choice']?['Value']),' ',item()?['Choice']?['Value'])

 

I have made the following test and it works just fine.

 

In the Create HTML table, use the following code for each field.

Title: item()?['Title']

Choice: item()?['Choice']

 

In the Send email action, make sure select Yes for Is HTML field.

1.PNG2.PNG

 

 

 

Best regards,
Mabel Mao

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
Community Support Team
Community Support Team

Re: Handling non-existant properties?

Hi @howitzer1972,

 

Yes, it is a default behavior for action Select, any blank value won’t be allowed for the value. All the columns must contain value when using action Select.

 

While we could use a function to return a blank value depends on the situation.

 

For the Choice column, please try the following code:

if(empty(item()?['Choice']?['Value']),' ',item()?['Choice']?['Value'])

 

I have made the following test and it works just fine.

 

In the Create HTML table, use the following code for each field.

Title: item()?['Title']

Choice: item()?['Choice']

 

In the Send email action, make sure select Yes for Is HTML field.

1.PNG2.PNG

 

 

 

Best regards,
Mabel Mao

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

howitzer1972
Level: Powered On

Re: Handling non-existant properties?

Thank you, that worked. 

 

Power of a Question Mark!

 

I had tried the same approach but used various iterations of  item()?['Choice']?['Value'] but never tried using a ? between all of the terms.

 

 

 

Lexn
Level: Power Up

Re: Handling non-existant properties?

Having empty values in Select action caused issues so needed a way to use default value in case of empty. This solution worked for me!

Thank you @v-yamao-msft!!!

 

if(empty(item()?['Address']),'blank',item()?['Address'])

flow empty select.JPG

LenC
Level: Power Up

Re: Handling non-existant properties?

I guess this is a solution to Select's problem - using the 'if' conditional for source properties. Seems kind of tortured. I looked at other array activities such as "Create HTML Table". It has NO problem if one of the properties of the input array is missing. But Select the same input array fails pulling the same field out of a collection of SharePoint items returned by SharePoint GetItems().

 

I noticed that the Flow Expression Editor | Dynamic Properties references items with the syntax item()?['PropertyName'] or items('iterator name')?['PropertyName'] - including the question mark. In many Flow activities, the question mark is retained when the flow is saved. But in the Select activity, the question marks get removed after saving. Which you can see by peeking the code, or exiting and returning to the editor.

 

Why is Select different than most activities in this regard?

Helpful resources

Announcements
firstImage

Microsoft Business Applications Virtual Launch Event

Watch the event on demand 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: 72 members 2,988 guests
Recent signins:
Please welcome our newest community members: