Dealing with empty Person fields in Flow

%3CLINGO-SUB%20id%3D%22lingo-sub-187833%22%20slang%3D%22en-US%22%3EDealing%20with%20empty%20Person%20fields%20in%20Flow%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-187833%22%20slang%3D%22en-US%22%3E%3CP%3EI%20am%20trying%20to%20build%20a%20flow%20connected%20to%20a%20SharePoint%20list%20with%20a%20few%20person%20fields.%20However%20if%20I%20try%20to%20access%20any%20of%20the%20person%20fields%20and%20they%20are%20blank%2C%20it%20chokes.%20I%20even%20get%20an%20error%20if%20I%20try%20to%20test%20the%20field%20for%20null%20or%20empty.%20I'm%20not%20sure%20how%20to%20proceed.%20These%20are%20not%20required%20fields.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20error%20I%20get%20is%20something%20along%20the%20lines%20of%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CEM%3EThe%20template%20language%20expression%20'triggerBody()%3F%5B'PersonField'%5D%5B'DisplayName'%5D'%20cannot%20be%20evaluated%20because%20property%20'DisplayName'%20cannot%20be%20selected.%3C%2FEM%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EDoesn't%20seem%20to%20matter%20which%20field%20I'm%20trying%20to%20get%3A%20Claims%2C%20DisplayName%2C%20Email%2C%20etc%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-187833%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EMicrosoft%20Flow%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESharePoint%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-187863%22%20slang%3D%22en-US%22%3ERe%3A%20Dealing%20with%20empty%20Person%20fields%20in%20Flow%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-187863%22%20slang%3D%22en-US%22%3E%3CP%3EThanks%20for%20the%20quick%20answer.This%20helped%20me%20clarify%20things%20a%20little.%20In%20case%20it%20helps%20anyone%20else%2C%20here's%20what%20I%20had%20to%20do.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EInitialize%20variables%20for%20each%20field%20(no%20value).%26nbsp%3B%3C%2FP%3E%3CP%3ETry%20a%20condition%20against%20each%20person%20field%2C%20testing%20the%20Object%20field%20itself%20(not%20Claims%2C%20DisplayName%2C%20etc)%20for%20null.%26nbsp%3B%3C%2FP%3E%3CP%3EThen%20if%20it%20wasn't%20null%2C%20I%20could%20assign%20the%20right%20value%20to%20the%20variable.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20think%20my%20problem%20was%20that%20I%20was%20testing%20my%20conditionals%20against%20a%20value%20in%20the%20object%2C%20not%20the%20object%20itself.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20again.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-187837%22%20slang%3D%22en-US%22%3ERe%3A%20Dealing%20with%20empty%20Person%20fields%20in%20Flow%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-187837%22%20slang%3D%22en-US%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F4572%22%20target%3D%22_blank%22%3E%40Courtney%20Prothero%3C%2FA%3E%2C%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI%20would%20look%20at%20setting%20variables%20as%20shown%20here%3A%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fveenstra.me.uk%2F2018%2F04%2F20%2Fmicrosoft-flow-getting-your-sharepoint-field-values%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fveenstra.me.uk%2F2018%2F04%2F20%2Fmicrosoft-flow-getting-your-sharepoint-field-values%2F%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EYou%20will%20need%20to%20use%20conditions%20to%20then%20check%20the%20value%20of%20the%20people%20fields%20before%20doing%20anything%20with%20them.%3C%2FP%3E%3C%2FLINGO-BODY%3E
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.