Sitecore Connect: Improving Recipe Efficiency through Simultaneous Execution of Autonomous Actions

When constructing a recipe within Sitecore Connect, you may encounter scenarios where certain tasks are independent of each other and do not require sequential execution, the default approach in Sitecore Connect. Opting to execute them simultaneously can significantly enhance job speed in real time, thereby improving overall system efficiency.


This can be accomplished by utilizing parameterized Recipe Functions that can be configured for asynchronous execution. The following blog elucidates how to implement this capability in Sitecore Connect.

Below is an example of a Recipe that creates a subscriber in Send and a guest user profile in CDP for a newly registered user in Azure B2C,

In the above Recipe, the Sitecore Send actions are clearly independent of CDP actions. On a related note, this also reminds us of the Cohesion and Single Responsibility Principle, which insists on breaking them down into functions. To execute the actions independently and asynchronously, you will need to follow the below steps,

  1. Select the steps that can be executed independently and copy them,
  2. Create a new function following the usual Recipe creation process and by selecting ‘Build Recipe function’ option,
  3. Paste the copied steps onto the new function,
  4. Add the required parameters(Eg: Email Address, Name, etc.) for the function by selecting the Function call Trigger and remap the old parameter references in the newly added steps to the new function-level parameters
  5. Invoke the function from the main recipe by adding a new ‘Call Function’ action by passing the required parameters and selecting asynchronous option,
  6. In case you need to wait for both the asynchronous calls to complete, then add ‘Wait for an async call to complete’ action and specify the Timeout limit if needed
  7. As a best practice, create tests for the individual recipe functions and ensure error handling to handle failures

As you can see, by setting up Recipe functions, we are not only able to execute multiple actions in parallel for improved efficiency, but at the same time, we can build modular & reusable elements that can be individually tested and maintained.

Leave a Reply

Your email address will not be published. Required fields are marked *