I have a multivalue metadata element on my custom document type. I would like to run code when this information changes, but I need to know which items were added or removed from the list of elements in order to run this code.
Simplified examples:
- Document contains ['item1'] - user adds 'item2' to this list and clicks Save. My handler runs and sees that the value has changed from ['item1'] to ['item1', 'item2'] for this element. It performs work for the new 'item2'.
- Document contains ['item1', 'item2'] - user removes 'item1' from this list and clicks Save. My handler runs and sees that the value has changed from ['item1', 'item2'] to ['item2']. It performs work for the old 'item1'.
There must be several ways to implement this, but it is a simple enough concept that I think there must be a "best" way in the general case. Could someone give a general outline or a pointer to existing code/documentation that handles metadata changes on documentModified?