Hello. I'm using the O365Users connector to look up employees in Active Directory. If an employee is NOT in AD, the response is Body: [].
I cannot figure out how to determine if "[]" is true using a Condition.
I've tried 10 different Expressions including:
Can anyone assist?
Thank you
Solved! Go to Solution.
Jeez, this is crazy. Finally got this after spending MANY hours trying every variation...
Apparently taking the Body from Search_for_users and comparing it to an empty() array...
Is NOT the same as adding empty() alone...
This is the type of thing that make learning Flow VERY DIFFICULT.
Jeez, this is crazy. Finally got this after spending MANY hours trying every variation...
Apparently taking the Body from Search_for_users and comparing it to an empty() array...
Is NOT the same as adding empty() alone...
This is the type of thing that make learning Flow VERY DIFFICULT.
I agree! I ran into the same problem.
I ended up convering the body array to a string and checking if the length was less or eq to 2 ([]):
length(string(body('Search_for_users')))
Not very elegant but it works for me.
gosh I wish I found this thread earlier... think I've gone through every iteration other than that one
@RezaDorrani also showed me another method for this type of check. Might be of use to folks...
empty(body('Search_for_users')) is equal to true
You don't need to convert to string. you can try use length(body('Search_for_users')) equal 0
Hello! And apologies for hijacking this thread slightly but I have a question on the back of it.
You / OP has said "If an employee is NOT in AD, the response is Body: []"
However I'm finding that the body for one particular flow / user is [] even though they ARE in AD. And I'm wondering if anyone knows why this might be? I can see the user has a handful of empty data fields within their AD user object (Job Title, Department etc) so my go-to thought is that they are being treated as a non-entity because one of these fields is empty, but I'm not sure if that's definitely the case, or which field if it is the case.
Thank u!, it worked perfectly.
You are correct. Your solution is even better. Thanks.
Hi,
This seems like bug as workaround what I did is create another variable as empty array used that to compare with out value which in our case is body i believe.
Check out new user group experience and if you are a leader please create your group
See the latest Power Automate innovations, updates, and demos from the Microsoft Business Applications Launch Event.
User | Count |
---|---|
53 | |
41 | |
39 | |
38 | |
36 |
User | Count |
---|---|
76 | |
72 | |
71 | |
54 | |
49 |