Update other case type during case processing
Let's say, there are two case types in your application - W- and C-.
In the W- case processing, we want to update C- case in real time. For this, I have created an activity that does Obj-Open C- with a lock, Property-Set, Obj-Save and Commit and placed this activity in the post processing in Flow Action of W- case type.
It works fine most of the times, but I just noticed it throws an error as below when C- case is actually locked by someone else.
This error makes sense because C- is a different case type and it could happen - someone else may have it opened for an update. What would be the best practice to handle such situation? Should I implement some logic to loop and check if lock is held with a certain time? If so, can someone show me a sample code?
Thanks,