Question

Self
US
Last activity: 19 Feb 2025 16:04 EST
Right API to Update Case
Usecase - Service REST activity needs to update a case with data from payload. The case is using optimistic locking. Also the same case can be opened by a user and worked upon.
Challenges - We have been having challenges with transaction management and locking of the case as some updates from service call are failing.
Question - What would be the right api/activity to be used in service activity to update the case?
Findings -
1) For opening a case we plan to use pxGetCase api - this internally does Obj-Open-By-Handle without acquiring lock.
2) For updating the case we planned to use pxUpdateRecord api. The good thing with pxUpdateRecord was that it was taking care of locking, staleness check and doing commit all within with good error handling. But looks like this pxUpdateRecord api doesnt support saving case instances as it was doing a Show-Harness on review harness. Looks like 'bSaveAndContinue' parameter is not passed correctly from Work-!.Save. This was confirmed by support team that pxUpdateRecord doesnt support case instances.
3) Other option was to use acquireWorkObject api to acquire lock, do the transformation and invoke Work-!Save API which even commits. [OR] call UpdateWorkObject with commitWithErrorHandling.
Wanted to get thoughts from the community on the right way for saving cases which uses optimistic locking.
Thanks!