function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Fakeha QuaziFakeha Quazi 

How to retrieve 1000 Flows metadata using MetaData API?

I am using Metadata api to retrieve Flows metadata. I am using Andy' solution to call Metadata API through apex. But it has limitation that we can pass an array of Flows fullNames of size 10. 1 callout is reserverd to get all the the flows using ListMetadataQuery and rest 99 can be used further to retrieve metadata. So we can get maximum 990 flows data. As we can have 1000 Flows in an Org. So, if an org has 1000 Flows then this process fails. I am using below code. Is there any way to retrieve all 1000 Flows metadata in apex? 

/*------Retrieve all Flows and Process------*/
MetadataService.ListMetadataQuery mdQuery = new MetadataService.ListMetadataQuery();
mdQuery.type_x = 'Flow';
MetadataService.ListMetadataQuery[] mdqList = new MetadataService.ListMetadataQuery[] {};
mdqList.add(mdQuery);
Double mdVersion = 37.0;
MetadataService.FileProperties[] fpList = service.listMetadata(mdqList, mdVersion);
System.debug('@@@ metadata result size = ' + fpList.size());
for (MetadataService.FileProperties fp: fpList) {
    System.debug('@@@ Flow name: ' + fp.fullName);
}
/*------Get 10 Flows-Process--------*/
MetadataService.Flow flow =
            (MetadataService.Flow) service.readMetadata('Flow',
                flowNameArray).getRecords()[0];
/*------------- some Flow data----------*/
System.debug('Name ' + flow.FullName);
System.debug('recordCreate ' + flow.recordCreates);