It's all about the answers!

Ask a question

How to retrieve workitem changes and attribute modifications?

VK L (8177146159) | asked Jun 06 '12, 5:45 a.m.
retagged Jun 06 '12, 4:02 p.m. by David Olsen (5237)
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?


3 answers

permanent link
Muthukumar C (32712833) | answered Jun 07 '12, 9:25 a.m.
edited Jun 07 '12, 9:26 a.m.
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.


VK L commented Jun 07 '12, 9:33 a.m. | edited Jun 08 '12, 9:56 a.m.

Hi Muthukumar,

                           How to capture the delete operation?

Muthukumar C commented Jun 07 '12, 9:39 a.m. | edited Jun 08 '12, 9:57 a.m.

I cant see any point in capturing the Delete operation. What ever the code you are writing in the Plugin will be executed during the SAVE operation. (Modification / Creation)

In which scenario you want to capture the delete operation.??

VK L commented Jun 08 '12, 12:58 a.m. | edited Jun 08 '12, 9:57 a.m.

      the scenario is such that we are updating 1 parent record - which is of another WI Type based on updations made in WI Items of another category. So, when a WI is deleted, i will have to restore the values in the parent record to deduct the contents of the deleted record. Its more of calculation based


Muthukumar C commented Jun 08 '12, 1:05 a.m. | edited Jun 08 '12, 9:58 a.m.

Sorry valli, I am totally out of loop now.

Actually you are having a Plug-in that will execute when saving a work item. (Create / Modify)
In the plug-in code itself, you will delete another work item or what? I am not sure whether I am reading you correctly.

Else, Are you asking for - your code should execute during the deletion of WI manually???

Better to post some code from your plug-in so that I can see the workflow of the Plug-in and where your requirement is hidden

permanent link
VK L (8177146159) | answered Jun 10 '12, 10:22 p.m.
       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?


permanent link
Muthukumar C (32712833) | answered Jun 29 '12, 3:27 a.m.
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]


Your answer

Register or to post your answer.