cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
drake
Advocate III
Advocate III

How do you check for Null in Power Automate Desktop? (versus empty)

We need to check to see if a JSON value is null or not.  Here is the JSON:

 

 

"customfield_25300": null,

 

 

When using the "If" statement, with "Isn't empty", a "variable doesn't have a property" error message is presented (screenshots below).  This error message doesn't appear, however, if customfield_25300 contains a value (e.g. "John") instead of null.  This makes us think that our value in "First operand" is correct, but that the null in the JSON is in some way confusing the "If" statement.

 

How do you check for null in Power Automate Desktop?

 

drake_0-1625839208896.png

 

drake_1-1625839366352.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
yoko2020
Responsive Resident
Responsive Resident

There is already solution here 

 

 

More Samples

Copy and paste to your PAD designer.

SET NewVar TO $'''{\"name\":\"John\", \"age\":30, \"car\":null}'''
Text.Replace Text: NewVar TextToFind: $'''%'null'%''' IsRegEx: False IgnoreCase: False ReplaceWith: $'''%'\"\"'%''' ActivateEscapeSequences: False Result=> NewVar
Variables.ConvertJsonToCustomObject Json: NewVar CustomObject=> JsonAsCustomObject
IF IsEmpty(JsonAsCustomObject['car']) THEN
    Display.ShowMessage Icon: Display.Icon.None Buttons: Display.Buttons.OK DefaultButton: Display.DefaultButton.Button1 IsTopMost: False ButtonPressed=> ButtonPressed3
END

 

View solution in original post

2 REPLIES 2
yoko2020
Responsive Resident
Responsive Resident

There is already solution here 

 

 

More Samples

Copy and paste to your PAD designer.

SET NewVar TO $'''{\"name\":\"John\", \"age\":30, \"car\":null}'''
Text.Replace Text: NewVar TextToFind: $'''%'null'%''' IsRegEx: False IgnoreCase: False ReplaceWith: $'''%'\"\"'%''' ActivateEscapeSequences: False Result=> NewVar
Variables.ConvertJsonToCustomObject Json: NewVar CustomObject=> JsonAsCustomObject
IF IsEmpty(JsonAsCustomObject['car']) THEN
    Display.ShowMessage Icon: Display.Icon.None Buttons: Display.Buttons.OK DefaultButton: Display.DefaultButton.Button1 IsTopMost: False ButtonPressed=> ButtonPressed3
END

 

takanee
Frequent Visitor

@drake 
This could be a solution.

  • Add In/Out Variable with 'Empty'
    • Not "Set Variabes"

takanee_1-1633437085559.png

usage example

takanee_2-1633437122267.png

 

Power Automate Desktop: null を利用する方法 - Qiita

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (4,518)