We created one logic app, in which we fetched records from CRM using the Common data service i.e List Records.
This records further filter using the filter array in the For each loop. The for-each loop is running on the result of the Stored procedure of SQL Server and the result returns more than 9000 records. The List Record action returns the all the records from CRM and in the foreach loop we filter the records by adding conditions and return the result.
For each loop executed for each record successfully but in the Run details, it showing the error on the Filter conditions and failing the Logic app and giving the following error message
{"code":"ActionResultsSizeLimitExceeded","message":"The action 'Filter_GSL_Status_by_Code' was executed for '9069' iterations resulting in an aggregated result size that exceeded the maximum value '209715200' bytes allowed. Please reduce the number of iterations to ensure that the aggregated results size is less than '209715200' bytes."}
According to your error message, the filter cannot break through its own limitations, so you cannot use the filter to solve your problem.
Maybe you can use Inline Code in your logic app to filter array. Within Inline Code
, you need to use javascript.
For example
Array:
[
{
"testKey1": "testValue1",
"testKey2": "testValue2",
"testKey3": 1
},
{
"testKey1": "testValue11",
"testKey2": "testValue22",
"testKey3": 2
},
{
"testKey1": "testValue3",
"testKey2": "testValue3",
"testKey3": 3
},
{
"testKey1": "testValue4",
"testKey2": "testValue4",
"testKey3": 4
}
]
Azure logic app workflow:
Js code:
var arr = <your-array>;
var resultArr = [];
for(var i=0; i<arr.length; i++){
var item = arr[i];
var key3 = item.testKey3;
if(key3 > 2){
resultArr.push(item);
}
}
return resultArr;
By the way, you need to add integration account to your logic app.