Problems in DWFActivityClaim & DWFActivityReassign. ErrorCode 4 while claiming: "Claim was aborted to avoid save conflict"

I have an automated activity agent which reassigns activities of one user to another. It loops through list of application databases, searches for activities (documents) of user ‘A’ in “SKWebMyActivity”.If this document(activity) is not claimed one then I first claim it using DWFActivityClaim() API and then reassign using DWFActivityReassign() to user B (Canonical Name).

For claimed activities ,directly call DWFActivityReassign().

Out of list of application databases, it works fine for current app DB.

But for activities from other databases, it gives following error while claiming for unclaimed activities

“ErrorCode:4 Claim was aborted to avoid save conflict.”.

I am claiming these activities on bahalf of JobOwner.

Other problem is … For claimed activities, Reassign API does not give any error, but the changes which are supposed to be made to

ExpandedParticipantAuthorsOS field of both cover and main(binder) document, are only made in Cover doc and not in main doc.

For both the above cases it is working fine only for current database from the list application DBs.

Can anybody help me??? (!!)

Subject: Problems in DWFActivityClaim & DWFActivityReassign. ErrorCode 4 while claiming: “Claim was aborted to avoid save conflict”

I got the solution for my problem…I extracted(/deleted) the code for reasign from existing agent and pasted it in new agent. (This new agent is there in every appDB ).

In the loop of list of app Dbs, I pass necessary parameters to this new agent and run it using

agent.RunOnServer(ParamDoc.NoteID)

Now it does not give any error code 4 while claiming and works well.

But still if anybody has idea about Errorcode :4

“Claim was aborted to avoid save conflict”

please do post it.