How to actually list ALL CDS records in Flow


The List records action in the Common Data Service (current) connector can be used to retrieve records from an entity in the CDS. Technically, this action returns an EntityItemList body, which is an array of individual EntityItems1.

If you use this action in your Flow without further configuration, only 512 EntityItems will be returned by default. In other words, whatever operation you had in mind for your Flow for the records listed, that operation will be applied to a maximum of 512 records.

This limit will work for many scenarios, but what if you want to bulk update a lot of records? Luckily, the List records action supports pagination by default. This limit can be configured up to a maximum of 100,000 in the action settings2.

List records pagination settings List records pagination settings

But what if even 100,000 records are not enough? An example scenario could be that you introduced new metadata in your data model and want to update all existing records in your CDS.

So, how to actually list ALL CDS records?

  1. Initiliaze a boolean variable and give it a name, for example Continue. Initialize variable Continue Initialize variable Continue

  2. Add a Do until control, which contains the remainder of the actions. Do until control Do until control

  3. In the condition, check if List records is still returning items by using an expression int(length(body('List_records')?['value'])) Condition to check if list still returns items Condition to check if list still returns items

  4. If true, continue with the rest of your flow to update existing records. If false, however, set the Continue variable to false to exit the Do until control. Set Continue variable to false Set Continue variable to false

This Flow does not stop at 100,000 records, but should retrieve all records based on your List records action.

More information

  1. List records action: ↩︎

  2. LogicApps pagination:] ↩︎

Common Data ServiceFlow

A quicker method to map different option set values in Flow

Troubleshooting the ribbon - UCI style