Return and reuse previous Snap in Pipeline

We would like to revisit a previous Snap in the Pipeline without having to create multiple branches and refer to multiple variables.

SnapLogic doesn’t seem to permit this so is there another way of achieving this in SnapLogic within the same Pipeline?

SnapLogic Visit Previous Snap

Here are the steps:

  1. Search for an existing record using SF Lookup Snap
  2. If record exists, proceed to Merge Id’s Join Snap
  3. If record does not exist, map fields to prepare for new record creation
  4. Create record
  5. Return to the previous SF Lookup Snap
  6. If record exists (which it now should), proceed to Merge Id’s Join Snap

Hi @NAl,

You want to do something like while loop, but SnapLogic as I know is not supporting any type of loop.
SnapLogic is stateless platform. That means when some snap is executed you can’t go back again and execute it.

One solution to do loop is to create another one pipeline like this and at the end with ForEach snap call them each other.

To work as loop you will need to select in Execution Mode this FIRE_AND_FORGET.

With this FIRE_AND_FORGET it will execute the pipeline what we are calling and it will not wait for response.

If it’s not selected this FIRE_AND_FORGET it will work the same way as Pipeline Execute snap
and because it will wait for response of the called pipeline the instances will never be closed.

This is not best solution because:

  1. ForEach in documentation is deprecated.
  2. If we do some change in one of those two pipelines you will also need to apply it to the second.

@viktor_n is correct that SnapLogic is a streaming platform so there is no concept of looping logic. This is a shift in thought for many developers coming from a programming background.

Note that ForEach is a deprecated snap and is not guaranteed to be supported in the future. Instead use a Pipeline Execute snap to call a child pipeline.

My design recommendation is to create a child pipeline to get the SF record. In the child, you can do the lookup and either return the value, or perform the create record, then lookup again (if necessary) and return the record to the calling pipeline. Now it won’t matter if the record originally existed or not, the child takes care of it so the parent doesn’t have to know the difference.

One of the ways that you can use pipeline execute and not wait for the child to finish is in the child, have a Mapper Snap which is un-connected output, in which you map the pipepipe.ruuid to an output value. This will execute once the pipeline is started, and return to the parent the runtime id (which can be used to query for status if desired), This has the same effect as using Fire and Forget of the ForEach Snap.