jeromepereira - Thursday, April 22, 2010 1:55 AM:
I wrote the below AML based on one I used for bom imports. I think I am close...any suggestion would be appreciated <Item type=
"Part AML" action="add">
<source_id><Item type="Part" action="get" where="Part.item_number='40-0001-00'"></source_id>
<related_id><Item type="Manufacturer Part" action="get" where="Manufacturer Part.item_number='BC57H687C-ITM-E4'"/></related_id>
<state>Preferred</state></Item>
Thanks !
RobMcAveney - Friday, April 23, 2010 12:04 PM:
You can use the where attribute if you want, but using property tags is usually easier:
<Item type="Part AML" action="add" id="3C547346A56141138327CA83BBCB0E3C">
<source_id>
<Item type="Part" action="get">
<item_number>40-0001-00</item_number>
</Item>
</source_id>
<related_id>
<Item type="Manufacturer Part" action="get">
<item_number>BC57H687C-ITM-E4</item_number>
</Item>
</related_id>
</Item>
You can't set the state property on import because many other things (permissions, workflows, etc.) may be set when an item is promoted. I always try to set the id of anything I'm importing so it's easier to back out or perform additional operations. In your case, it would be good to set ids so you can subsequently promote the Part AML records to Preferred:
<Item type="Part AML" action="PromoteItem" id="3C547346A56141138327CA83BBCB0E3C">
<state>Approved</state>
</Item>
<Item type="Part AML" action="PromoteItem" id="3C547346A56141138327CA83BBCB0E3C">
<state>Preferred</state>
</Item>
If you need to generate a bunch of ids to import see this page: http://www.aras.comhttp://www.aras.com/Community/wikis/kb/generating-ids.aspx
jeromepereira - Tuesday, April 27, 2010 3:06 AM:
Thanks Rob.....that worked....I am still new to writing AML...but your approach worked for me. Thanks again !