Relationship XML Definition

A relationship specifies the cardinality and behavior of two associated objects in a direction. The source of the relationship, such as invoice, is object 1 and the associated objects, such as line item, is object two. A corresponding relationship in the other direction would be defined with line item as object 1 and invoice as object 2. The following topics describe the XML elements that define a relationship:

RelationshipDef Node

The following table describes the child elements of a RelationshipDef node:

Element Name XML Element Type Data Type Description
id Attr int The relationship ID.
origId Attr int The original ID of the relationship
relName Attr String The required integration name for this relationship.
objDef1 Attr String A required value that specifies the integration name of the first object.
objDef2 Attr String A required value that specifies the integration name of the second object.
singularName1 Attr String A required value that specifies the singular name for the first object.
singularName2 Attr String A required value that specifies the singular name for the second object.
pluralName1 Attr String A required value that specifies the plural name for the first object.
pluralName2 Attr String A required value that specifies the plural name for the second object.
fkobjDef Attr String For external relationships, specifies the integration name of the foreign key object.
pkColumn Attr String For external relationships, specifies the name of the database column that contains the Primary Key.
fkColumn Attr String For external relationships, specifies name of the database column that contains the Foreign Key.
isMultiple1 Attr Boolean Specifies whether to allow multiple related records for the first object (Many to N).
isMultiple2 Attr Boolean Specifies whether to allow multiple related records for the second object (N to Many).
orphanControl1 Attr Boolean Specifies whether to control orphan records for the first object. For example, with a relationship between obj1 and obj2, setting this element to True will delete obj1 records when the related obj2 record is deleted.
orphanControl2 Attr Boolean Specifies whether to control orphan records for the second object. For example, with a relationship between obj1 and obj2, setting this element to True will delete obj2 records when the related obj1 record is deleted.
cloneRelated1 Attr Boolean Specifies whether to clone related records for the first object.
cloneRelated2 Attr Boolean Specifies whether to clone related records for the second object.
isSystem Attr Boolean Specifies whether this relationship is a system relationship.
isPkFk Attr Boolean For external objects, specifies whether this is a primary key-foreign key relationship.
addToPages Attr Boolean Specifies whether a relationship created by an API call should be added in a new lookup field on user interface pages.

Example of a relationship definition

The following example shows a RelationshipDef node:

<RelationshipDef id="19877" origId="19877" relName="R19877" objDef1="b" objDef2="a1" singularName1="B" pluralName1="Bs" singularName2="A" pluralName2="As" isMultiple1="yes" isMultiple2="yes" orphanControl1="no" orphanControl2="no" cloneRelated1="no" cloneRelated2="no" isSystem="no" isPkFk="no">
</RelationshipDef>