Jump to content

How to retrieve EARLIEST record from an entity with a N:1 relationship to the source data

David Carr

Recommended Posts

I have a flow that creates Dynamics 365 Opportunities. The opportunity is linked to one Account. One Account is linked to many Account Teams (custom entity). I want to find the EARLIEST record (based on createdon date) from the Account Team entity, to pass into the Owner ofthe Opportunity.

My source file is a spreadsheet representing each opportunity I want to create. I loop through all of these records, creating one opportunityfor each.

I have a lookup block to return the Account GUID, which I could then pass into the Account Team lookup block. But there aren't any operators in a lookup block that would retrieve the earliest account team record.

Any ideas

Many thanks in advance,


Link to comment
Share on other sites

  • 4 weeks later...

Hi David,

There is no option to configure the sort by in the Query block.

Usually it's oldest records first and newest records last.


If you want that extra control I would suggest using a Native Query block where you can define your FetchXML statement, which allows for a sort by statement.




Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...