Related Object Lookup Using the SOAP API

You can use a related object lookup to set the internal ID of any related object indirectly when you add, update or upsert an object if you know the external ID or the name of this related object. To do so:

  1. Use the following argument object property.

    Name

    Type

    Description

    attributes

    oaFieldAttribute[]

    A collection of oaFieldAttribute objects.

    Note:

    Most business object types except those used as substructures such as Address, Date, and Module support the attributes property.

  2. Create a collection of oaFieldAttribute objects.

  3. For each object property referencing related object(s) by internal ID you want to set indirectly using a lookup.

    1. Add one object to the collection of oaFieldAttribute objects.

    2. Pass the external ID or name instead of the internal ID, or a comma-separated list of external IDs or names instead of Internal IDs as property value.

Sample codes: Update Using External ID as Foreign Key Lookup — C# and Modify with Foreign Key Lookup — Java.

oaFieldAttribute

The SOAP API uses a oaFieldAttribute object as a substructure to define a related object lookup.

The oaFieldAttribute object has the following properties:

Property

Description

name

Specifies the foreign key.

  • Set name to external to use the object's external ID [externalid] as foreign key.

  • Set name to name to use the object's name [name] as foreign key.

value

Specifies the object property referencing related object(s) by internal ID, the related object type, an optional flag indicating whether object property value referencing related object(s) by internal ID is a comma-separated list.

Format (single internal ID):

related_objectid:RelatedObjectType 

Format (multiple internal IDs):

related_objectids:RelatedObjectType:1 

where related_objectid or related_objectids is the object property referencing related object(s) by internal ID, RelatedObjectType is the related object type.