Skip to main content

Notifications

Community site session details

Community site session details

Session Id : t8dAhd1eK9+E6XktMvVTeo
Power Automate - Building Flows
Answered

Selecting a Single Row from Table

Like (0) ShareShare
ReportReport
Posted on 18 Apr 2023 17:47:11 by 18

Hello, 

 

I need help fetching a singular record from a table to use in a lookup field on a parent table...

 

I have a table of approvers, with the columns: 

Approver ID

Approver (user lookup)

Department (choice)

Title (choice)

There is only one approver for each Department (ex. accounting) with a given Title (ex. manager)

 

Based on values in the Parent table, I want to auto assign an approver based on the title and department, on a row in the Parent table that is a lookup field.

 

I essentially want to do a "get" call on the table to fetch a record based on a specific Title and Department (which should never return multiple records, since they are unique combinations of Title and Department)

 

The closest I can get is with the Dataverse List Rows function, but this returns a table and automatically applies an Apply to Each on the record I want to update with the approver I retrieved, even though based on my filtering it should be a table of 1 record.

 

madi1_0-1681839924501.png

 

Is there a way to get just the one record so that I can use it in the Dataverse Update Row function in lookup field to the Approver table?

 

Alternatively, if I could just retrieve the Approver ID, I could use that to populate the lookup field in the Parent table.

  • madi1 Profile Picture
    18 on 19 Apr 2023 at 16:39:26
    Re: Selecting a Single Row from Table

    This worked! Thank you!

     

    For anyone else with this issue, or myself in the future when I forget how to do this: This video gives a visual on how to get the record by itself, as well as how to work with lookup columns in power automate

     

    https://www.youtube.com/watch?v=EsRWGw-KYtA

  • Verified answer
    Pstork1 Profile Picture
    66,015 Most Valuable Professional on 18 Apr 2023 at 19:55:06
    Re: Selecting a Single Row from Table

    The output of the List Rows is already an array and you should be able to access the fields using the first() function without having to do a Parse Json.  You will need to type the JSON fieldname into the  expressions tab manually.  Using the dynamic content will add an apply to each loop.  But the field name is the same as what you would get inside the loop.

  • madi1 Profile Picture
    18 on 18 Apr 2023 at 18:38:59
    Re: Selecting a Single Row from Table

    If I save the output of the List Rows into an array, do I use a Parse Jason action to use the first() function? 

  • Pstork1 Profile Picture
    66,015 Most Valuable Professional on 18 Apr 2023 at 18:00:57
    Re: Selecting a Single Row from Table

    The easiest way is to either do a list rows with an appropriate OData filter or to do Filter Array after you get all the rows.  Then you can use the First() function to get the first row of the array that is returned.  If you only need the value from one column you can append that column name to the end of the First() funtion in JSON and it will return just that one value. Something like this

    first(Outputs('List_rows'))?['Approver']?['Email']

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,700 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,015 Most Valuable Professional

Leaderboard
Loading started