ADO.NET Provider for SugarCRM

Build 26.0.9655

IncludeRelationships

Specifies whether the provider exposes relationship columns, which allow you to query objects in relation to other objects.

Data Type

bool

Default Value

false

Remarks

Relationships define the links between different modules in SugarCRM and allow records between those modules to be related. When two modules have a many-to-many relationship, the provider exposes a relationship view to allow querying across them. The columns in a relationship view are a combination of the columns from each side of the join, following the naming convention REL_{LeftModuleName}_{RightModuleName}.

Set this to true to expose relationship views. By default, this feature is turned off. Note that querying relationship views may be expensive depending on the data volume in the system.

When this feature is enabled, two additional columns are added to each table:

RelationTypeThe name of the related module.
RelationIdThe ID of the corresponding record in the related module.

For example, if the Documents module is linked to the Cases module by a many-to-many relationship, you can query only the related IDs along with all the data from the Documents module:

-- Retrieve all Documents columns and the corresponding Case IDs in the RelationId column.
SELECT * FROM Documents WHERE RelationType = 'cases'

-- Query a relationship view directly to get the combined columns from both Accounts and Tasks.
SELECT * FROM REL_account_tasks

-- Filter Accounts by a specific related contact ID.
SELECT * FROM Accounts WHERE accounts_contacts = 'e9b69b60-41e0-11ea-82f2-02424563122e'

-- Filter Notes by a specific related account ID.
SELECT * FROM Notes WHERE accounts_notes_1 = '514b69aa-41e0-11ea-a5ef-02424563122e'

-- Filter Accounts by multiple related note IDs.
SELECT * FROM Accounts WHERE accounts_notes_1 IN ('4a6cd5de-f40e-11ea-99f0-02f85148f4a4', '456ffdc2-f40e-11ea-86ca-02f85148f4a4')

Copyright (c) 2026 CData Software, Inc. - All rights reserved.
Build 26.0.9655