Relationships

1. Get Item Relationship Types

getItemRelationshipTypes () (since 5.5)

Parameters

None.

Description

This returns all the relationships, along with their class and a marker to denote inherited ownership. Format: *RelationName [RelationClass] (the asterix will not be present if ownership is not inherited). The ‘Key’ to the HashMap is the relationTypeId, which needs to be passed into the createItemRelationship() function (below).

2. Create Item Relationship

createItemRelationship (String fromItemId, String toItemId, String relationTypeId) (since 5.5)

Parameters

  • fromItemId The unique Id of the source Item to create a relationship from, the parent.
  • toItemId The child side of the relationship to create a link to.
  • relationTypeId An ID from the getItemRelationshipTypes() function signifying the type of relationship to create.

Description

This method will validate if the relationship exists before trying to create a new one.

3. Delete Item Relationship

deleteItemRelationship (String fromItemId, String toItemId, String relationTypeId) (since 5.5)

Parameters

  • fromItemId The unique Id of the source Item to create a relationship from, the parent.
  • toItemId The child side of the relationship to create a link to.
  • relationTypeId An ID from the getItemRelationshipTypes() function signifying the type of relationship to create.

Description

The inverse of create – a convenience method to delete the relationship.

4. Get Item Relationships

getItemRelationships (String itemNumber) (since 6.0)

Parameters

  • itemNumber The unique item number to identify the relationships for.

Description

This returns all the related items for an item with the given itemNumber. The returned HashMap will contain the Item Number of the related Item, and a Relationship ID.