Event PX: How to retrieve a MPN object from save as

I am trying to write an event on Create n Save as of an MPN to set a Page Two attribute to “Yes”. I was able to create the PX for create action but unable to get MPN object.

How to retrieve a  MPN object from save as? 

Thanks
Ridhi

Add Comment
5 Answer(s)

Hi Ridhi,
Could you please try what has been discussed in the following post?
https://myagileplm.com/answer/re-retrieving-an-item-created-with-saveas-via-api/

It should be the same a part from the fact that you are operating with a MPN object

Agile Angel Answered on January 26, 2017.
Add Comment

Antonio,

Thanks for your response, the issue i am running into when loading an MPN you would need MFR Name and MFR Part Number …..the API has getNewNumber() ….. I am not sure how to load it.

Thanks
Ridhi

Agile User Answered on January 26, 2017.
Add Comment

does anyone know how to get the new MPN?

Agile User Answered on January 30, 2017.
Add Comment

Details of Manufacturer Name and Manufacturer Part can be fetched from history table.We can fetch mpn using that information.

Agile Talent Answered on March 27, 2017.
Add Comment

It’s complicated, but doable.  Write a script that gets the original manufacturing object like so:

IEventInfo req = obj.getPXEventInfo();
IObjectEventInfo objectEventInfo = (IObjectEventInfo)req;
IDataObject originalmfrpart = objectEventInfo.getDataObject()
String newNumber = obj.getNewNumber()  //this is thew new part number
String manufacturer = originalmfrpart.getValue(1647) //gets the old Manufacturer

Then use the manufacturer of the old item to load the new Manufacturing object.
Note, this won’t work (returns a null object) if you change manufacturer on the save as.  There, write a separate method to fetch the value from the history tab of the old object like karthik mentioned above (I used some clever use of tokenize and getAt).

Agile Angel Answered on September 28, 2017.
Add Comment

Your Answer

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