Automation engine or Process extention how do I set a part in the bom during creation

I am trying to set a single part when creating a new part. I am trying to do it in a process extension with groovy or use automation engine.
For example if I create a new part and it is a item resistor I want a part to automatically add to the BOM each time.
What is the best method to use for this? Do you have some examples?

Add Comment
2 Answer(s)

This would be a post event script where after the user creates the item the script would create another item and add it to the BOM of the user created item. The script created item can be a save as from an item “template” or created from scratch using default values. You’ll find a lot of sample code at and in the API documentation.

Agile Angel Answered on May 17, 2019.
Add Comment

Thank you this does help but I did get an example that I started working with. It was “AddDocNewPartPX” This works when creating a new part after I set it to activate only on a specific part type of SellableItems. The example is pointing to PCBA.
My big issue is I can get it to work on a single part number and once that part number is used it can not be used again, even if I create a new number that is different. For example I built part 123.1 and it creates the part 500.1212 
I then create a new part 124 and it should add 500.1212 to the BOM but it won’t.

Now if I go back into the code and update part 500.1212 to 500.1213 or any other number it will work one time. And from that point forward part 500.1213 is not going to work on any other number.

Here is the part I chanced from the example: 

// Create a new item and add it to the item BOM
IAgileClass itemclass=admin.getAgileClass(ItemConstants.CLASS_PART);
//IAutoNumber docNumber = docclass.getAutoNumberSources()[0];
String docNumber = “500.1212” + ” “;
IItem item = (IItem) session.createObject(itemclass, docNumber);
ITable tab = part.getTable(ItemConstants.TABLE_BOM);
obj.logMonitor(“Succeed to add document ‘”+ doc.getName() +”‘ to item ‘”+part.getName()+”‘”);

Agile User Answered on May 17, 2019.
Add Comment

Your Answer

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