How to add Previous revision item and remove current from relationship

Hi Experts,

I am trying to remove Document which is attached to Part with revision 001 and attach Document with revision 000(old revision).

I have created an action on Part Document relationship.

I'm getting the old revision item id i.e Document id, after getting this ID I'm trying to create a relationship between Part and Document with below code.

var newPartDocRelItem = inn.newItem("Part Document", "add");


newPartDocRelItem.setProperty("sort_order", sort_order);


newPartDocRelItem = newPartDocRelItem.apply();

But, above code will add the same item i.e item with revision 000

I have also tried this code

var newPartDocRelItem = inn.newItem("Part Document", "add");

newPartDocRelItem.setProperty("source_id", parentPartID);

newDocItem = inn.newItem("Document", "get");

newDocItem.setProperty("id", oldItem);


newPartDocRelItem = newPartDocRelItem.apply();

Still I'm not able to add the relationship with previous revision, Document with 001 revision gets added

  • Hello,

    This depends on the behavior of the RelationshipType. By default, the behavior of a relationship is set to Float which means that the relationship will always point to the latest generation of the related item. If you would like your relationships to point to previous generations you can set the behavior to Fixed by following the steps below.

    1. Login as admin
    2. Navigate to TOC > Administration > RelationshipTypes
    3. Search for Part Document
    4. Open this item for edit
    5. Change the Behavior dropdown to Fixed
    6. Save this RelationshipType


    Christopher Gillis

    Aras Labs Software Engineer