How to retrieve workitem changes and attribute modifications?
Hi All,
I have written a code to fetch the attribute values from a workitem - triggered on the save operation (Operation Participant Plugin). I want to distinguish if it's a new/modify/delete operation - plus the changes that are made during each of the save operation - like the old and new values of a particular attribute and so on. How can this be achieved programatically?
Thanks.
I have written a code to fetch the attribute values from a workitem - triggered on the save operation (Operation Participant Plugin). I want to distinguish if it's a new/modify/delete operation - plus the changes that are made during each of the save operation - like the old and new values of a particular attribute and so on. How can this be achieved programatically?
Thanks.
3 answers
Hi Valli.
Below code snippet will solve your query
Object data = operation.getOperationData();
if(data instanceof ISaveParameter){
ISaveParameter saveparameter = (ISaveParameter)data;
IAuditable WIOldState = saveparameter.getOldState();
IAuditable WINewState = saveparameter.getNewState();
..........
...........
...........
In this code, WIOldState will have the Old values of the work item attributes and WINewState will have the values during the save.
Of course, if WIOldState== null, then it means Creation of NEW Work Item.
Hope its usefull.
Regards
Muthukumar.C
Below code snippet will solve your query
Object data = operation.getOperationData();
if(data instanceof ISaveParameter){
ISaveParameter saveparameter = (ISaveParameter)data;
IAuditable WIOldState = saveparameter.getOldState();
IAuditable WINewState = saveparameter.getNewState();
..........
...........
...........
In this code, WIOldState will have the Old values of the work item attributes and WINewState will have the values during the save.
Of course, if WIOldState== null, then it means Creation of NEW Work Item.
Hope its usefull.
Regards
Muthukumar.C
Comments
Hi,
I have a plugin that executes on WI-Save operation and its an Operation Participant. Once a record is created, i use the values to update another WI record (different WI Type). So, i want to execute a part of the code in the same plugin - during deletion of WI - to redo the changes made. How to capture the WI delete operation?
Thanks.
I have a plugin that executes on WI-Save operation and its an Operation Participant. Once a record is created, i use the values to update another WI record (different WI Type). So, i want to execute a part of the code in the same plugin - during deletion of WI - to redo the changes made. How to capture the WI delete operation?
Thanks.
Hi Valli,
After a long, I hope, I got a solution for your requirement....
Hope you remember that we will mention Plugin Action as WorkItemSave during the creation of Plug-in.
Same way, you can create a plugin which will execute during the Delete operation of WIs. You can add this plugin in the preconditions of the Delete Work Item [Server]
Regards
Muthukumar.C
After a long, I hope, I got a solution for your requirement....
Hope you remember that we will mention Plugin Action as WorkItemSave during the creation of Plug-in.
Same way, you can create a plugin which will execute during the Delete operation of WIs. You can add this plugin in the preconditions of the Delete Work Item [Server]
Regards
Muthukumar.C