Avoid Participant Propagation
We have the following WI structure:
WorkItem3(fathers father)
|--WorkItem2 (father)
|--WorkItem1
We created an Operation Participant that when the user modifies an attribute in WorkItem1, it updates this value in the fathers WorkItem (WorkItem2).
The trouble we are finding is that when the value in WorkItem2 is automatically updated and saved by the Operation Advisor, another instance of the Operation Participant is triggered and tries to update the WorkItem3. Normal behavior, but not desired one: we need only one level of propagation.
We cant find the way of detecting who triggered the Save Operation, whether the user, or the "workItemServer.saveWorkItem2()" operation in the Participant.
Any idea about how to tackle it??
Appreciate any comment.
Thanks
Noel.
WorkItem3(fathers father)
|--WorkItem2 (father)
|--WorkItem1
We created an Operation Participant that when the user modifies an attribute in WorkItem1, it updates this value in the fathers WorkItem (WorkItem2).
The trouble we are finding is that when the value in WorkItem2 is automatically updated and saved by the Operation Advisor, another instance of the Operation Participant is triggered and tries to update the WorkItem3. Normal behavior, but not desired one: we need only one level of propagation.
We cant find the way of detecting who triggered the Save Operation, whether the user, or the "workItemServer.saveWorkItem2()" operation in the Participant.
Any idea about how to tackle it??
Appreciate any comment.
Thanks
Noel.
Accepted answer
Hi Eduardo. I have just received an update on this question.
First of all, thanks a lot for your answer.
I actually got to solve the problem by passing a flag between the participants. I found it the clearest way to perform simple communication between advisable operations (advisor/participants).
Works as follows:
Set the flag in the save operation of WorkItem 1:
>additionalSaveParameters.add(MY_FLAG);
>saveWorkItem3(workItem, references, workflowAction, additionalSaveParameters)
Receive the flag in the excution of the operation aprticipant in WorkItem 2:
>ISaveParameter saveParam = (ISaveParameter) operation.getOperationData();
>if(!saveParam.getAdditionalSaveParameters().contains(MY_FLAG){
//Execute propagation in WorkItem2
}
Hope this can help others.
NOEL.
First of all, thanks a lot for your answer.
I actually got to solve the problem by passing a flag between the participants. I found it the clearest way to perform simple communication between advisable operations (advisor/participants).
Works as follows:
Set the flag in the save operation of WorkItem 1:
>additionalSaveParameters.add(MY_FLAG);
>saveWorkItem3(workItem, references, workflowAction, additionalSaveParameters)
Receive the flag in the excution of the operation aprticipant in WorkItem 2:
>ISaveParameter saveParam = (ISaveParameter) operation.getOperationData();
>if(!saveParam.getAdditionalSaveParameters().contains(MY_FLAG){
//Execute propagation in WorkItem2
}
Hope this can help others.
NOEL.
2 other answers
Hi, I'm facing the same problem but instead of the infinite loop behaviour I'm obtaing a blocking one by several advisors. Is there a way to make a builtin advisor to skip the execution if a postop already run?
I mean there exist a builtin FLAG to skip builtin advisor executions?