How to Prevent Infinite Loop in Two-Way Synchronization Between Two Applications?

I’m currently working on establishing a two-way connection between two applications in Creatio for adding and modifying records.
 

  1. One-Way Connection: I successfully created two business processes that allow for one-way synchronization of records.
  2. Two-Way Connection Issue: However, when I attempt to set up the two-way synchronization, it leads to the creation of multiple records in an infinite loop instead of just one record being created or updated.

 

Could anyone provide guidance on how to avoid this infinite loop in a two-way connection? Any insights on best practices for implementing two-way synchronization in Creatio would also be greatly appreciated.
 

I can provide screenshots of my setup for further clarification if needed. I followed the same process for the one-way connection as shown in the attached business process screenshot.

Like 0

Like

2 comments

Good day,

The issue you're encountering is related to the number of records being passed to the subprocess. Here are some suggestions for resolving this situation:

1. Add or adjust recursion trigger conditions:
   - For instance, if the trigger is based on changes to the `Contact.Age` field, consider adding a condition to ensure the age is not empty before initiating recursion.

2. Redesign the process to avoid recursion:
   - Replace recursion with iteration: Instead of processing records one by one with recursion, you can read and process multiple records in a sequential manner, ensuring that you do not handle a new record until the current one is fully processed.
   - Consolidate changes into a single process: Rather than reacting to various changes across different processes, use one process to handle all necessary changes at once. For example, initiate triggers in a single business process (BP) with all modifications related to a specific entity, which helps in minimizing and managing recursion more effectively.

It is crucial to first review the process logic with the above suggestions, as increasing the `MaximumBackgroundRecursionDepth` parameter could lead to application performance issues, such as slowing down or exhausting server memory, which might result in application restarts or stops.

In your system, the `MaximumBackgroundRecursionDepth` parameter is currently set to 100 (default is 100). The issue arises when the number of subprocess calls exceeds this value.

To address this problem, you may need to increase the `MaximumBackgroundRecursionDepth` parameter to accommodate all records, rather than only the initial 100.

Regards,
Orkhan

You need to have some way to determine the source of a record, so if the record came from the other object, you don't send it back again. 

For records added in "Data App", you'd flag those as coming from "Data App" when adding in "Info App", so the process that syncs from "Info App" back to "Data App" knows to exclude it from sending back to "Data App", etc.

If the records need to sync updates as well, you'd want to store the original record's Id value so you know where to update. You could then use the column storing the Id to know to exclude sending it back to add.

Ryan

Show all comments