Relationships
Relationship steps manage the connections between Dynamics 365 records—associating and disassociating related entities.
Associate Relationship
Links two records via a relationship.
| Parameter | Description |
|---|---|
| Entity | The primary entity type |
| Entity ID | The primary record ID |
| Relationship | The relationship schema name |
| Related Entity | The entity type to associate |
| Related Entity ID | The ID of the record to associate |
Example:
ASSOCIATE RELATIONSHIP
Entity: Account
Entity ID: Customer.Id
Relationship: account_contacts
Related Entity: Contact
Related Entity ID: NewContact.Id
Associate Multiple Relationships
Links multiple records to a single record in one operation.
| Parameter | Description |
|---|---|
| Entity | The primary entity type |
| Entity ID | The primary record ID |
| Relationship | The relationship schema name |
| Entities | Collection of records to associate |
This step is more efficient than calling Associate Relationship multiple times in a loop.
Example:
ASSOCIATE MULTIPLE RELATIONSHIPS
Entity: Team
Entity ID: SalesTeam.Id
Relationship: teammembership_association
Entities: NewTeamMembers
Disassociate Relationship
Removes the link between two records.
| Parameter | Description |
|---|---|
| Entity | The primary entity type |
| Entity ID | The primary record ID |
| Relationship | The relationship schema name |
| Related Entity | The entity type to disassociate |
| Related Entity ID | The ID of the record to disassociate |
Example:
DISASSOCIATE RELATIONSHIP
Entity: Account
Entity ID: Customer.Id
Relationship: account_contacts
Related Entity: Contact
Related Entity ID: FormerContact.Id
Disassociate Multiple Relationships
Removes links between multiple records and a single record in one operation.
| Parameter | Description |
|---|---|
| Entity | The primary entity type |
| Entity ID | The primary record ID |
| Relationship | The relationship schema name |
| Entities | Collection of records to disassociate |
Example:
DISASSOCIATE MULTIPLE RELATIONSHIPS
Entity: Campaign
Entity ID: Campaign.Id
Relationship: campaignitem_association
Entities: RemovedProducts
Get Entities by Relationship
Retrieves records related to a given record via a specific relationship.
| Parameter | Description |
|---|---|
| Relationship Type | The cardinality: 1-1 (one-to-one) or 1-N (one-to-many) |
| Entity | The primary entity type |
| Entity ID | The primary record ID |
| Relationship | The relationship schema name |
| Related Entity | The related entity type to retrieve |
Returns: Single record (1-1) or collection of related records (1-N)
Example - One-to-Many:
GET ENTITIES BY RELATIONSHIP
Relationship Type: 1-N
Entity: Account
Entity ID: Customer.Id
Relationship: account_contacts
Related Entity: Contact
→ Store in variable: CustomerContacts
Example - One-to-One:
GET ENTITIES BY RELATIONSHIP
Relationship Type: 1-1
Entity: Contact
Entity ID: Contact.Id
Relationship: contact_customer_account
Related Entity: Account
→ Store in variable: ParentAccount
Best Practices
Use Correct Relationship Names: Always use the exact relationship schema name from Dynamics 365. You can find this in the entity customization area.
Batch When Possible: Use Associate Multiple / Disassociate Multiple when working with several records to improve performance.
Check Existing Relationships: Before associating, consider whether the relationship already exists to avoid duplicate relationship errors.
Handle Many-to-Many Carefully: Many-to-many relationships require using the intersect entity relationship name.