cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

how to bypass the blank field values in Select action

Hi All,

 

I am trying to get azure ad user properties using "Invoke an HTTP request".

If the field/property has value then returning the field with value is fine, but the field/property is blank/null connector is not returning the column itself and returns an error saying that the column does not exist.

 

but in Explorer, it returns null. in power automate "Invoke an HTTP request" connector is not returning any null or blank. it returns an error.

muralikrishna12_0-1668777686308.png

 

from power automate 

 

muralikrishna12_1-1668777936996.png

if you observe from the error screenshot, the company name field itself does not exist as it says.

 

first of all the "Invoke an HTTP request" itself does not return the Company Name field

here is the connector API Query 

https://graph.microsoft.com/v1.0/users/88e356d7-fca8-4124-90b6?$select=displayName,mail,userPrincipalName,companyName

here is the response to the above REST API connector it self Company name is excluding because of user property company name is blank/null, if value exist then its returning as expected 

{
  "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users(displayName,mail,userPrincipalName,companyName/$entity",
  "displayName": "sample",
  "mail": "sample@outlook.com",
  "userPrincipalName": "sample",
  "id": "88e356d7-fca8-4124-90b6",
}

 

In fact, if we try for another user who has the value from the backend then it gets the company name itself.

 

how to get field value even if it is blank and assign to Select action. because only a few users do not have the Company Name values.

 

any help here, please

 

 

  

1 ACCEPTED SOLUTION

Accepted Solutions
Sundeep_Malik
Community Champion
Community Champion

Hey @muralikrishna12 

 

For this you can try one of the two things. I hope atleast one works for you. 😅

 

1) Condition Action:

 

So, the condition action will check that your json data contains a value as companyName or not.

If it has make a select action for including it.

And if it does not have it, then make a select action excluding it. 

 

Sundeep_Malik_0-1668779432975.png

 

2) To use if inside the selection. Not sure this one would work or not.

 

Write this expression, or somewhat similar expression:

 

if(contains(outputs('Compose'),'companyName'),item()?['companyName'],'')
 
So, in this I am checking if the data contains companyName, if it has, then just take the company name with item()?['companyName'] and if it does not have the company name, just take null with the help of two single quotes without any space between them.
 
Sundeep_Malik_1-1668779630592.png

 

 

I hope atleast one works for you. Change some fields or name according to your case. 

 

If this works for you, you can accept the answer as the solution and if you liked the explanation or even appreciate the effort please give a thumbs up. 🙂

View solution in original post

5 REPLIES 5
Sundeep_Malik
Community Champion
Community Champion

Hey @muralikrishna12 

 

For this you can try one of the two things. I hope atleast one works for you. 😅

 

1) Condition Action:

 

So, the condition action will check that your json data contains a value as companyName or not.

If it has make a select action for including it.

And if it does not have it, then make a select action excluding it. 

 

Sundeep_Malik_0-1668779432975.png

 

2) To use if inside the selection. Not sure this one would work or not.

 

Write this expression, or somewhat similar expression:

 

if(contains(outputs('Compose'),'companyName'),item()?['companyName'],'')
 
So, in this I am checking if the data contains companyName, if it has, then just take the company name with item()?['companyName'] and if it does not have the company name, just take null with the help of two single quotes without any space between them.
 
Sundeep_Malik_1-1668779630592.png

 

 

I hope atleast one works for you. Change some fields or name according to your case. 

 

If this works for you, you can accept the answer as the solution and if you liked the explanation or even appreciate the effort please give a thumbs up. 🙂

I think I need to show the screenshot of the flow actions. because Invoke an HTTP request connector itself does not return the company field, if the connector returns the company name either blank/null then we can format it in the select query using the If condition.

 

muralikrishna12_1-1668781058705.png

 

Please check the screen, after the connector

I am setting values into an array to bind and converting them into an array to select each field.

 

how do check whether a field exists or not from the array,

this way we can check first if field find then we can understand company name is not blank,

if Company Name is not found in the array then we can understand and use a select query with the out Company name.

 

Please reply

 

Sundeep_Malik
Community Champion
Community Champion

@muralikrishna12 

 

In the above methods, I am first checking if the field is present only. In your case in the condition action, just pass the variable. 

 

So, just follow the steps I told in the above message. 

Option 1 helps me

 

Thank you @Sundeep_Malik 

Sundeep_Malik
Community Champion
Community Champion

So for everyone coming in future to check out the post. The better technique to use for this would be a

coalesce function.
 
Here is the answer:
 
In compose adding json data.
Sundeep_Malik_0-1668796689814.png

 

Then using coalesce function in select:

Expression: 

coalesce(item()?['companyName'],'empty')

 

Sundeep_Malik_1-1668796741175.png

 

 

Final Output:

 

Sundeep_Malik_2-1668796814329.png

 

Thanks @Pstork1 for the approach. 🙂

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 (2,938)