How do I get the value of a key-pair?

Firebird105x 20 Reputation points
2023-06-07T06:18:45.3533333+00:00

Using Azure Logic Apps, I want to retrieve a UserID whenever I have a specific email address.

End Goal: An email comes in with "employee5@example.com". Using logic apps, using this email "employee5@example.com", I will reference this array and retrieve the UserID "005".

Currently, I have 2 variables.

  1. A dynamic variable from the trigger "UserEmailAddress"
  2. An Object variable "UserList" which is the list below"

I tried using Select but I have no idea how to match.

How do I go about achieving this?

I have an array with the following:

[
  {
    "EmailAddress": "employee1@example.com",
    "UserID": "001"
  },
  {
    "EmailAddress": "employee2@example.com",
    "UserID": "002"
  },
  {
    "EmailAddress": "employee3@example.com",
    "UserID": "003"
  },
  {
    "EmailAddress": "employee4@example.com",
    "UserID": "004"
  },
  {
    "EmailAddress": "employee5@example.com",
    "UserID": "005"
  }
]
Azure Logic Apps
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
3,240 questions
{count} votes

Accepted answer
  1. MayankBargali-MSFT 70,651 Reputation points
    2023-06-07T10:57:49.7033333+00:00

    @Firebird105x Thanks for reaching out.

    You need to leverage the Filter array for your requirement. In filter array you need to compare @item()['EmailAddress'] with your UserEmailAddress variable. The From will be your UserList.

    User's image

    User's image

    The filter array will retrieve the matching values. If you have always one matching value then you need to use body('Filter_array')[0]['UserID'] to get the userID value. In case if there are more matching value then you need to leverage the loop.

    For your reference sharing the reference guide of function used in logic app.

    Feel free to get back to me if you need any assistance.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.