Workitem approval changes workflow state?
I am writing an advisor that is responsible to decide whether the save operation can be allowed based on the state of all the approvals that exist in the workitem.
Upon debugging the code, I noticed something strange to me. When the approver closes an approval and saves the workitem, the workflow state for the oldstate and new state show that the server thinks a workflow state transition is about to take place, even though the state of the workitem has not been changed by the user.
Why is RTC behaving like this? This behaviour is throwing off my validation logic that says that if the workflow state is not changing, the advisor does not need to do anything. How do I compensate for this?
Upon debugging the code, I noticed something strange to me. When the approver closes an approval and saves the workitem, the workflow state for the oldstate and new state show that the server thinks a workflow state transition is about to take place, even though the state of the workitem has not been changed by the user.
Why is RTC behaving like this? This behaviour is throwing off my validation logic that says that if the workflow state is not changing, the advisor does not need to do anything. How do I compensate for this?
3 answers
have you tried the precondition "Required Approvals" which does :
"Verifies that a work item can only be saved if all required approvals are in the configured state."
You can reach it through:
Open PA in Eclipse Client > Process Configuration Tab > Team Configuraiton > Operation Behavior > Work Items > Save Work Item (server) > under specific role > Preconditions > Add Required Approvals > Work Item Type > Select specific state and Edit Approvals
"Verifies that a work item can only be saved if all required approvals are in the configured state."
You can reach it through:
Open PA in Eclipse Client > Process Configuration Tab > Team Configuraiton > Operation Behavior > Work Items > Save Work Item (server) > under specific role > Preconditions > Add Required Approvals > Work Item Type > Select specific state and Edit Approvals
Comments
Hello Ralph,
I know of that possibility and it is disabled in my case. I did a bit more debugging and this is what I found:
- on the first attempt to save the item after an approval is closed by the approver, RTC returns the next state of the workitem on the workflow as being "state.s2".
- on a 2nd attempt to save the workitem, after the first attempt is rejected by the advisor, without making any changes to the workitem, the same RTC returns the next state of the workitem as being "state.s1".
I wonder why is it doing this and how on earth am I to compensate for this behaviour in order to make the right decision in the advisor?
Thanks,
Dan
I know of that possibility and it is disabled in my case. I did a bit more debugging and this is what I found:
- on the first attempt to save the item after an approval is closed by the approver, RTC returns the next state of the workitem on the workflow as being "state.s2".
- on a 2nd attempt to save the workitem, after the first attempt is rejected by the advisor, without making any changes to the workitem, the same RTC returns the next state of the workitem as being "state.s1".
I wonder why is it doing this and how on earth am I to compensate for this behaviour in order to make the right decision in the advisor?
Thanks,
Dan