KamranAftab - Wednesday, November 27, 2013 12:55 PM:
Hi All, I tried the script provided in the developer reference to create a BOM: 999-888 Some Assy 10 123-456 1/4w 10% 10K Resistor This works fine. However, I am trying to modify it to create the BOM relationship between existing parts. I tried "get" instead of "add": It seems to run fine, but doesn't do anything as far as creating the BOM relationship. How do I create a parent/child relationship between items that already exist in the database? Thanks, KamranDavidSpackman - Wednesday, November 27, 2013 7:41 PM:
HI Kamran,
You will need to use the edit action. The edit action requires either a where or id attribute in the Item tag.
Example 1 (I have used the item_number property of the Part, however I could have used any available property)
<Item type="Part" action="edit" where="item_number='C5316-60108'">
<Relationships>
<Item type="Part BOM" action="add">
<related_id>
<Item type="Part" action="get">
<item_number>1121-9011</item_number>
</Item>
</related_id>
</Item>
</Relationships>
</Item>
Example 2
<Item type="Part" action="edit" id="BF81DF9CCA2C46D39D2C28C2B38FCF89">
<Relationships>
<Item type="Part BOM" action="add">
<related_id>
<Item type="Part" action="get">
<item_number>1121-9011</item_number>
</Item>
</related_id>
</Item>
</Relationships>
</Item>
KamranAftab - Friday, November 29, 2013 9:36 AM:
Thanks a lot David. This worked as you prescribed!
Kamran