0

Problem: When the number plate is not in the list, I can not get the 'no match found - email Facilities department' email to fire.

I've used the 'Get Items' command, as the 'Get Item' only allowed me to select 'ID' which is no good for my purposes. 'Get Items' allows me to filter on a list to check if a number plate is known to us.

e.g. 'DE11BOY' is the number plate of a rascal who's parked in the wrong place. If you arrive at work and find he's parked there, to get his car shifted out the way you submit a form: just type his number plate and click 'submit' (see picture below). This triggers power automate into action.

In the picture below you see two 'known' number plates, MA22OLE and AA99ABC. These values are stored in a list called 'WMT Finder'.

Outputs

  • If the number plate does exist it should trigger a 'YES' email to be sent (yes - the number plate is known, it emails a manager - tell so-and-so to move their car.

  • Likewise, the flow should trigger 'NO' email for when the number plate is not in the WMT Finder list - the email notifies the Facilities department to investigate.

Here's the process of what I want to achieve.

process diagram of form being submitted with number plate, some logic is applied to it.  If number plate found - email the manager.  If not, email the facilities department.

Power Automate

pt1

Form submitted, the compose actions get rid of any spaces and make the number plate capitalised. This makes it match up with the format of the list data (no spaces, all capitalised).

Next bit...'Get Items' - compare the value of the 'DE11BOY' number plate vs what's stored in the list. ('DE11BOY' is not a known vehicle, its number plate hasn't been logged here, so it should trigger the NO email).

pt2

pt3

Reminder of the problem

When the vehicle does exist, the email is sent.

When no number plate is found in the list (DE11BOY is not known), the email does not send.

I suspect the 'Get Items' command does not work as I intend it to. PStork's answer here suggests to me that I am misusing the 'Get Items' command; "...you can't query on null fields" - is mine a 'null field' is no number plate is found in my list??

Do I need to use an array instead?

Screenshot of flow with the changes recommended by Matiur.

email results

The 'yes' (green) email is sent when the number plate is not found. The 'no' (red) email is sent when the number plate is found.

As you can see it works using the 'Get Items' command.

1 Answer 1

2

[Get Items] returns any array, and you can check if the array is empty (length=0) or it has items. Based on that you could decide in PA which email to send.

See the example below.

length(outputs('Get_items')?['body/value'])

enter image description here

1
  • wow, thanks Matiur, that's done the trick!
    – Tally
    Commented Jul 16 at 16:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.