The Real-Time Conflicts Component was developed to resolve data conflicts in real-time in OutSystems applications, where multiple users access and edit the same complex data structure simultaneously. It provides an automated merge process (similar to Service Studio), with support for manual conflict resolution when necessary.
Automatic data merging based on three versions: original, active (server), and edited.
Conflict resolution similar to Service Studio, where the user can choose which value to keep.
100% front-end execution, reducing server load and improving performance.
Lodash library usage for efficient manipulation of complex JSON objects.
Reusable visual block for user conflict selection.
To perform the merging process, the user needs to provide the following three JSON objects as input in the MergeVersion action:
MergeVersion
OriginalVersion – The original structure loaded on the screen in JSON Format.
OriginalVersion
ActiveVersion – The most recent version of the structure saved on the server.
ActiveVersion
NewVersion – The structure modified locally after the server version.
NewVersion
OriginalVersion The original JSON initially loaded.
ActiveVersion: The current version of the JSON saved on the server.
NewVersion: The JSON with the modifications made locally by the user.
Return: A structure indicating whether the operation was successful or if an error occurred.
Return
MergedVersion: The resulting JSON after the merge, considering NewJSON changes as the default in case of conflicts.
MergedVersion
NewJSON
Conflicts: A list containing fields with similar/conflicting changes between ActiveJSON and NewJSON.
ActiveJSON
Different changes → automatic merge.
Conflicts on the same fields → NewVersion's value takes precedence, unless the user opts to choose manually.
The Conflicts list can be used to display a visual block with choices for the user.
A UI block that allows the end-user to visualize and choose the correct values for fields that have conflicts between ActiveJSON and NewJSON.
Conflicts: A list containing fields with similar or conflicting changes between ActiveVersion and NewVersion.
OldVersion: The original JSON initially loaded.
OldVersion
NewVersion: The JSON locally modified by the user.
MergedVersion: The resulting JSON from the merge, containing the automatic merge changes.
ReturnNewVersion: Returns the final JSON with the values selected by the user for the conflicting fields.
ReturnNewVersion
Add the Conflicts block in a pop-up modal.
Execute the MergeVersion(OriginalVersion, ActiveVersion, NewVersion) action.
MergeVersion(OriginalVersion, ActiveVersion, NewVersion)
Check the Conflicts list:
If there are conflicts, open the pop-up and pass the parameters to the block.
The user resolves the conflicts visually, and in the ReturnNewVersion event, the application receives the final adjusted JSON to be saved or processed as needed.
Scenario:
A form with hierarchical data (e.g., customer registration with contacts and preferences) is being edited by two users.
User A loads the data and stores the OriginalVersion.
They make modifications and save, updating the ActiveJSON on the server.
User B, who still had the older structure loaded, modifies the data and creates their own NewVersion.
Before saving:
The application executes MergeVersion(OriginalVersion, ActiveVersion, NewVersion).
The action returns:
MergedVersion: With the merged changes, considering NewVersion as the priority in conflicts.
Conflicts: A list of fields with similar changes in ActiveVersion and NewVersion.
If Conflicts is not empty:
The application opens the SolveConflicts block in a pop-up.
Pass the parameters: OldVersion, NewVersion, and MergedVersion.
The user selects the desired values.
The block returns the final JSON in the ReturnNewVersion event, which can then be saved or processed according to the business logic.
Prevents accidental overwriting in collaborative environments.
The merge logic on the front-end improves performance and user experience.
Integration with Lodash makes the component robust and efficient for handling nested objects.
The visual block makes conflict resolution easy and intuitive.
Lightweight, reusable, and easy to maintain.
The Data Merging Component was developed to resolve data conflicts in real-time in OutSystems applications, where multiple users access and edit the same complex data structure simultaneously. It provides an automated merge process (similar to Service Studio), with support for manual conflict resolution when necessary.
To perform the merging process, the user needs to provide the following three JSON objects as input in the MergeJSONVersion action:
MergeJSONVersion
OriginalJSON – The original structure loaded on the screen.
OriginalJSON
ActiveJSON – The most recent version of the structure saved on the server.
NewJSON – The structure modified locally after the server version.
OriginalJSON: The original JSON initially loaded.
ActiveJSON: The current version of the JSON saved on the server.
NewJSON: The JSON with the modifications made locally by the user.
MergedJSON: The resulting JSON after the merge, considering NewJSON changes as the default in case of conflicts.
MergedJSON
SimilarChanges: A list containing fields with similar/conflicting changes between ActiveJSON and NewJSON.
SimilarChanges
Conflicts on the same fields → NewJSON's value takes precedence, unless the user opts to choose manually.
The SimilarChanges list can be used to display a visual block with choices for the user.
SimilarChanges: A list containing fields with similar or conflicting changes between ActiveJSON and NewJSON.
OldJSON: The original JSON initially loaded.
OldJSON
NewJSON: The JSON locally modified by the user.
MergedJSON: The resulting JSON from the merge, containing the automatic merge changes.
ReturnNewJSON: Returns the final JSON with the values selected by the user for the conflicting fields.
ReturnNewJSON
Add the SimilarChanges block in a pop-up modal.
Execute the MergeJSONVersion(OriginalJSON, ActiveJSON, NewJSON) action.
MergeJSONVersion(OriginalJSON, ActiveJSON, NewJSON)
Check the SimilarChanges list:
The user resolves the conflicts visually, and in the ReturnNewJSON event, the application receives the final adjusted JSON to be saved or processed as needed.
User A loads the data and stores the OriginalJSON.
User B, who still had the older structure loaded, modifies the data and creates their own NewJSON.
The application executes MergeJSONVersion(OriginalJSON, ActiveJSON, NewJSON).
MergedJSON: With the merged changes, considering NewJSON as the priority in conflicts.
SimilarChanges: A list of fields with similar changes in ActiveJSON and NewJSON.
If SimilarChanges is not empty:
The application opens the SimilarChanges block in a pop-up.
Pass the parameters: OldJSON, NewJSON, and MergedJSON.
The block returns the final JSON in the ReturnNewJSON event, which can then be saved or processed according to the business logic.