1
votes

We created one logic app, in which we fetched records from CRM using the Common data service i.e List Records.

enter image description here

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.

enter image description here

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."}
1
It seems that the filter has been executed too many times. What is the data of the filter? - Frank Gong
Yes, the filter array executed for each record of the For each loop and For each loop executes multiple times i.e. currently we are getting the ResultSets of more than 9000 records from Store procedure - Ajay
I don't get it... which limitation are we hitting? Aggregated result size of what? - Ajay
The maximum value of the aggregated result size has been stated in your error message, and its size is 209715200 bytes. - Frank Gong
Aggregated result size seems to be the result size after the filter operation - Frank Gong

1 Answers

0
votes

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:

enter image description here

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.