Forum Discussion
Thanks again for your help
I am little bit confused. I have attached the pipeline. i could not figure out the exact logic that you mentioned.
Marketo recursive_2023_01_16.slp (55.6 KB)
2nd mapper in the pipeline:
Router in the pipeline:
3rd mapper could not figure out the logic:
Basically,
after the Rest Get (Get Lead Changes) Snap, you use the Group By N Snap with group size set to 0, to gather all of the responses in an array.
Once you have all of them in an array, use:
$group.findIndex(x => x.entity.success == false)
expression to get the index of the response from the array where entity.success == false.
This expression will return -1 if there is no response with entity.success == false.
Then by using Router:
So, if we there is no response with entity.success == false, you can just map the nextPageToken from the latest response from the group (the array), by using $group.pop().entity.nextPageToken
.
Otherwise, if there is a response with entity.success == false, you can get the nextPageToken from the latest response with entity.success == true from the group (the array) by using the following expression $group[$ind-1].entity.nextPageToken
.
Hope, this helps.
BR,
Aleksandar.