cancel
Showing results for 
Search instead for 
Did you mean: 

How to replicate the logic equivalent to while loop in Snaplogic pipelines

MuraliNagula
New Contributor

There is a child pipeline which returns values like completed, in queue, processing etc. The requirement is that parent pipeline to run this child pipeline till it returns Completed, of-course after certain wait time. Its like while loop, run the child pipeline, till the expression is true. How do accomplish this in snaplogic ?

Appreciate any pointers…

14 REPLIES 14

MuraliNagula
New Contributor

Unfortunately the response object for this Marketo Endpoint doesn’t have “Has Next” or “Next URL” attributes. Otheriwse my life would have been much easier !!!

You can find the details of the response object etc in the following link.

https://developers.marketo.com/rest-api/endpoint-reference/lead-database-endpoint-reference/#!/Bulk_...

GET /bulk/v1/leads/export/{exportId}/status.json

https://developers.marketo.com/rest-api/endpoint-reference/lead-database-endpoint-reference/#!/Bulk_...

The “next” properties are expressions. So, I would think you could write an expression to check the response to the status request to see if it was completed or not. If it was completed, the ‘Has Next’ expression should return false, otherwise it should return true. The ‘Next URL’ can just be the same as the main Service URL property.

cstewart
Former Employee

In the documentation for the REST Get Snap, there is an example for response form marketo:
REST Get Pagination: Marketo
For Marketo, set:

Has Next: resultdoc.moreResult
Next URL: “/rest/v1/activities.json?nextPageToken=” + resultdoc.nextPageToken + ”&activityTypeIds=1&activityTypeIds=12”

The difference is rest vs. bulk call.

christwr
Contributor III

The API for the child triggered task doesn’t have to return “Has Next” or “Next URL” properties directly, just something you can evaluate in expressions for those attributes in the REST GET snap.

For example:

2019-06-24_8-06-17

Or whatever type of expression that returns true/false based on whether you want the REST GET snap to do again…