Dealing with empty Person fields in Flow

Iron Contributor

I am trying to build a flow connected to a SharePoint list with a few person fields. However if I try to access any of the person fields and they are blank, it chokes. I even get an error if I try to test the field for null or empty. I'm not sure how to proceed. These are not required fields. 

 

The error I get is something along the lines of:

 

The template language expression 'triggerBody()?['PersonField']['DisplayName']' cannot be evaluated because property 'DisplayName' cannot be selected.

 

Doesn't seem to matter which field I'm trying to get: Claims, DisplayName, Email, etc 

2 Replies

Hi @Courtney Prothero,

 

I would look at setting variables as shown here:

https://veenstra.me.uk/2018/04/20/microsoft-flow-getting-your-sharepoint-field-values/

 

You will need to use conditions to then check the value of the people fields before doing anything with them.

Thanks for the quick answer.This helped me clarify things a little. In case it helps anyone else, here's what I had to do.

 

Initialize variables for each field (no value). 

Try a condition against each person field, testing the Object field itself (not Claims, DisplayName, etc) for null. 

Then if it wasn't null, I could assign the right value to the variable. 

 

I think my problem was that I was testing my conditionals against a value in the object, not the object itself.

 

Thanks again.