Difference Between Rollback and Obj-Save-Cancel
1. Obj-Save-Cancel:
• Purpose: This method cancels the most recent uncommitted Obj-Save operation. It ensures that
the instance is not written to the database as part of a later Commit operation
• Scope: It only affects the most recent Obj-Save operation. If you have multiple Obj-
Save operations, Obj-Save-Cancel will only undo the last one
• Usage: Use this method when you need to cancel a specific save operation without affecting
other uncommitted changes
2. Rollback:
• Purpose: This method cancels all uncommitted Obj-Save and Obj-Delete operations within the
current transaction. It reverts the system to the last stable state before the transaction began
• Scope: It affects all uncommitted changes in the current transaction, not just the most recent one
• Usage: Use this method when you need to cancel all changes made during the current
transaction, especially in the case of errors or inconsistencies
Commit with error handling:
The Call Work-.commitWithErrorHandling method in Pega is used to commit changes to the database with built-in
error handling.
Step-by-Step Explanation
1. Preparation: Before calling commitWithErrorHandling, ensure that all necessary changes have been saved
using the Obj-Save method. This method saves the changes to the clipboard but does not commit them to
the database yet.
2. Call the Method: Use the Call Work-.commitWithErrorHandling method in your activity. This method will
attempt to commit all changes saved with Obj-Save to the database.
3. Error Detection: During the commit process, the method checks for any errors. Common errors include
lock lost errors, deferred save failed errors, and database unavailability
4. Rollback on Error: If an error is detected, the method will automatically roll back to the last stable state
before the commit attempt. This prevents partial commits and maintains data integrity
5. Success Confirmation: If no errors are detected, the method completes the commit process, making all
changes permanent in the database.
Confidential - Not for Public Consumption or Distribution
The commitWithErrorHandling method in Pega can fail for several reasons, each of which triggers its error
handling and rollback mechanisms. Here are some common reasons:
Common Reasons for Failure
1. Lock Lost Error:
• Cause: Another user or process has acquired a lock on the work object you are trying to
commit.
• Impact: The commit cannot proceed because the work object is locked by another entity
2. Deferred Save Failed Error:
• Cause: Some changes could not be saved due to validation issues or constraints.
• Impact: The commit fails because the system cannot save all changes as required
3. Database Unavailability:
• Cause: The database is temporarily unavailable or experiencing connectivity issues.
• Impact: The commit cannot be completed because the database is not accessible
4. Page Messages:
• Cause: There are error messages on the primary page indicating issues with the data.
• Impact: The commit fails because the data on the primary page is not valid
How Rollback and Error Handling Work
1. Error Detection:
• During the commit process, commitWithErrorHandling checks for any of the above errors. If an
error is detected, it triggers the error handling mechanism
2. Rollback:
• If an error occurs, the method automatically rolls back to the last stable state before the commit
attempt. This means all changes made during the current transaction are undone, ensuring that
no partial changes are committed
3. Logging and Notification:
• The method logs the error, which can be used to notify users or administrators about the issue.
This helps in troubleshooting and resolving the error promptly
Confidential - Not for Public Consumption or Distribution