I need to go through users' worklists and reassign items to a workbasket at the end of the day. I'm trying to open the work object and Assign-WorkList object (into newAssignPage) and calling ReassignToWorkBasket with the workbasket name. The move is being made but the assignment is unrecoverably broken and the urgency is cleared out and sometimes the assignment/flow is getting blown out entirely. The error when launching from the workbasket is "The flow this assignment corresponds to is no longer at this task." with a button to Repair this Assignment that just closes the work tab.
What am I doing wrong? Is there something else I should use in this context?
In latest versions of Pega 7, In OOTB Case Manager portal, we have the ability to drag the assignment and drop it into the work basket, without needing to open the assignment. If you are using latest Pega7 version, I recommend you to leverage OOTB features.
I can tell you that the flow-no-longer-at-task error means the details on the pxFlow item on your work object and the flow properties on your assignment object are in disagreement. The damage occurred BEFORE the obj-save, so if you are trying to click the assignment from a work list or work basket and seeing that error, the damage was already done.
If you had your assignment in a state that did not get an error when you click it, and now it does get the error, you should track down where it is getting damaged.
A general guideline is, if you are using standard flow processing, don't do ANY obj-save or commit of your work object or assignment object, because the system will do it for you.
If you are doing something else where you think you do need an obj-save and commit, you can put in a check to make sure your pxFlow and assignment are in agreement before you do the obj-save, so that you protect your work from getting into this broken state.
In my testing I would launch from my worklist before the reassignment without issue. Every case I tried up to earlier today was producing the same problem but it started working after a server restart so I'm assuming it was a caching issue or some such.