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,

 

Can you provide the exact code you have written to update few attributes of a page through event .

 

on April 27, 2023.
Add Comment
2 Answer(s)
Best answer

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

Agile Angel Answered on July 28, 2016.
Add Comment

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.

Agile User Answered on July 28, 2016.

Hi Roberto,
Is it configured as PRE Event?

on July 28, 2016.

You’re right as usual Antonio, it was set as post! 🙂
Thank you very much, it is now working!

on July 28, 2016.

Great 🙂

on July 28, 2016.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.