cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
McMonty
Resolver I
Resolver I

CDS Get Record or List Records Filter Query

Hi,

I have a entity with a unique list of salutations (Mr, Mrs, Ms etc.) that I'm trying to get a single record from. 

I can't use "Get Record" unless I know the unique identifier, so I end up having to use "List Records" instead since the salutation is selected on an MS Form. The problem is that this creates an Apply to Each step. Surely you should be able to select a single record from an entity/table without having to use the id field? 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi, that's not really what I meant.

 

I already use this in the filter query: salutation eq 'response from ms form'

That works fine and will only return a single record, but it will automatically create a 'Apply for Each' step in the flow.

 

View solution in original post

4 REPLIES 4
fchopo
Super User II
Super User II

Hello @McMonty 

Have a look at this excellent post by @Pieter_Veenstra where he explains how to use the filter query using CDS: https://sharepains.com/2019/06/10/microsoft-flow-filter-queries-in-the-list-records-action-in-the-co...

In your case, you could do something like this:

flow.png

 

1) Get the records where Title equals "Mr".

2) If there is any item (length(body('list_records')?['value']) > 0)

3) If Yes -> Execute necessary steps according to what you need.

 

Hope it helps!

Ferran

 

Did I answer your question? Please consider to mark my post as a solution to help others.
Proud to be a Flownaut!

Hi, that's not really what I meant.

 

I already use this in the filter query: salutation eq 'response from ms form'

That works fine and will only return a single record, but it will automatically create a 'Apply for Each' step in the flow.

 

View solution in original post

 

Use [Parse JSON] to parse first item your get from output of the get records.   

 * following example use top 1 to get only one record but did not check if get records return null which you may need to check.

  * and any reason why do not want to have "Apply to Each" ?

 

FlowsNoApplytoEach.png

 

Hello @McMonty

As I understand, you want to access the first element of the array. Therefore you could use the solution provided by @MinRao

 

After you get the records, you can use a Compose action using the following expression:

 

 

first(length(body('list_records')?['value']))

 

 

And then access the fields of the record using:

 

 

outputs('compose')?['emailaddress1']

 

 

where emailaddres1 is the name of the field.

The second part of the flow could something like this:

 

flow.png

 

Hope it helps!

Ferran

Did I answer your question? Please consider to mark my post as a solution to help others.
Proud to be a Flownaut!

Helpful resources

Announcements
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Carousel April Dunnam Updated 768x460.jpg

Urdu Hindi D365 Bootcamp

Dont miss our very own April Dunnam’s The Developer Guide to the Galaxy! Find out what the Power Platform has to offer for the traditional developer.

Users online (1,870)