How do I find newly added Approvals in a Operation Advisor?
One answer
- Getting the old state of the work item
- Getting the new state of the work item
- Getting the approvals from the old state
- Getting the approvals from the new state
-
Figuring if there is a new one by comparing the number of attachments and finding the one that is not in the old list (maybe there is a date on the approval, not sure)
Comments
Hi Ralph
Just modify step 5 to say "Compare the entries on the old list of approvals with the entries on the new list of approvals. If there are any differences, fail the save request."
Also have a look at the UUID's of the approvals. These are unique and would allow you to determine any changes if you iterate both lists.
How do I get the UUID's of the approvals?
I don't see any applicable methods in the IApprovalDescriptor interface.
Interesting, usually everything has a UUID, but I couldn't find anything for approvals at a glance. You could try to debug if you can see anything that you could use to compare. Otherwise you have to resort to a text compare, which is not very precise.
You could use the hashCode() method, which should return a unique value