Retrieving an item created with SaveAs via API

Hi,
I’m creating a simple script that has to make few checks on an item cloned from another one.
It has to run triggered by a SaveAs Object event, but it goes checking the old item (the one that I saved as) and not the new item.

How can I correct these two lines of code to point to the newly created item?
IObjectEventInfo objectEventInfo = (IObjectEventInfo) eventInfo;
IItem currentItem = (IItem) objectEventInfo.getDataObject();

Add Comment
2 Answer(s)
Best answer

Hi Roberto,

As described in this topic  the Save As Event PX contains information about objcID and classID

ISaveAsEventInfo saveAsevent = (ISaveAsEventInfo) event;
Integer subclassId = saveAsevent.getNewSubclassId();
String newNumber = saveAsevent.getNewNumber();
IDataObject newObject = (IDataObject) session.getObject(subclassId, newNumber);

I hope that it is helpful

Agile Angel Answered on June 30, 2016.
Add Comment

Hi Antonio!
Thank you very much, it works perfectly. You’ve been very helpful, as usual! 🙂

Agile User Answered on June 30, 2016.

Great! Thanks 🙂

on June 30, 2016.
Add Comment

Your Answer

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