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
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
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
Details of Manufacturer Name and Manufacturer Part can be fetched from history table.We can fetch mpn using that information.
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).