Retrieving field name with the IUpdateEventInfo interface
Hi everyone,
I’m writing a simple Java PX that notifies a user whenever a field in a user page is modified.
I’m retrieving the modified fields with the instruction
IUpdateEventInfo info = (IUpdateEventInfo)eventInfo;
and if I print it in a log it returns
com.agile.px.UpdateTitleBlockEventInfo@3db02ef1|Event Type: 2000011554|Event Trigger Type: 2|User Defined Map: null|DataObject: tattile_admin|Dirty Cells: (1311, 1), (2014, 1)|Is Redline Update?: false
so it correctly recognizes that I modified cells 1311 and 2014, but how can I obtain the name of that field so that I could write it in the email? And how could I retrieve the old and the new value of those fields?
For example I’d like to write
“The field ‘pippo’ has been modified from ‘xxx’ to ‘yyy’
The field ‘pluto’ has been modified from ‘aaa’ to ‘bbb'”
Hi Roberto,
You can get info from the event and from the updated cells as below:
IUpdateTitleBlockEventInfo updateTableEvent = (IUpdateTitleBlockEventInfo)event;
IChange change = (IChange)updateTableEvent.getDataObject();
IEventDirtyCell[] cells = updateTableEvent.getCells();
for (IEventDirtyCell dirtyCell : cells) {
ICell cell = change.getCell(dirtyCell.getAttributeId());
System.out.println(“Cell “+dirtyCell.getAttribute().getFullName()+” changed from “+cell.getValue()+” to “+dirtyCell.getValue());
}
“cell” is the current value before the update. “dirtyCell” is the cell that is being to be set in Agile on the object
Let me know if it help you
Antonio
Thank you Antonio, it almost works perfectly.
The only thing that’s not going as expected is the cell.getValue(), it takes the last value of the cell and not the previous one.
Anjali123
Hi Roberto,
Can you provide the exact code you have written to update few attributes of a page through event .