Update Part Document Relationship

Hi,

I'm trying to update PART DOCUMENT relationship but facing issue: 

AML: 

<AML>
   <Item type="Part Document" action="edit" where="[Part_Document].id='C080331098D24F00B635418D823D97AC'">
    <related_id>AFF14CBFFD074494B00E3D247D8D11FE</related_id>
  </Item>
</AML>

getting Object reference not set to an instance of an object error.

how to edit this relationship as I want to attach different document on some condition.

Thanks,

Maddy.

  • Hi Maddy

    Consider the below scenarios

    Part 1 ---------> Document1

    Part 2 ---------> Document 1

    Scenario 1: If you want to replace Document 1 with Document 2 in both Part 1 and Part 2, use below AML query

    <AML> 
    <Item action="edit" type="Part Document" where="[Part_Document].related_id='DOCUMENT1_ID'" version="0">
    <related_id>DOCUMENT2_ID</related_id>
    </Item> 
    </AML> 

    Scenario 2: If you want to replace Document 1 with Document 2 only in Part 1, then use below AML query

    <AML> 
    <Item action="edit" type="Part Document" where="[Part_Document].source_id='PART1_ID'" version="0">
    <related_id>DOCUMENT2_ID</related_id>
    </Item> 
    </AML> 

    You can get the ID of the Part and Document by right clicking the corresponding item and in Properties

    Thank You

    Gopikrishnan