This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.
Working with Associate or DisAssociate Entities
Overview
The following operations allow you to work with associate or disassociate entities. Click an operation name to see details on how to use it.
For a sample proxy service that illustrates how to work with associate entities, see Sample configuration.
Operation | Description |
---|---|
Add a reference to a collection-valued or single-valued navigation property. | |
Remove entity reference to collection-valued navigation property | To remove a reference to an entity for the collection-valued navigation property. |
Remove Entity Reference to Single-Valued Navigation Property | To remove a reference to an entity for single-valued navigation property. |
Operation details
This section provides details of the operations.
Associate an Existing Entity
To add a reference to a collection-valued or single-valued navigation property, use msdynamics365.associateAnExistingEntity
.
<msdynamics365.associateAnExistingEntity> <entityType>{$ctx:entityType}</entityType> <bodyContent>{$ctx:bodyContent}</bodyContent> <primaryKeyValue>{$ctx:primaryKeyValue}</primaryKeyValue> <navigationPropertyValue>{$ctx:navigationPropertyValue}</navigationPropertyValue> <useCollectionValuedNavigationProperty>{$ctx:useCollectionValuedNavigationProperty}</useCollectionValuedNavigationProperty> </msdynamics365.associateAnExistingEntity>
Properties
- <entityType>: Mandatory. The type of an entity (i.e., accounts, opportunities, contacts etc).
- <bodyContent>: Mandatory. The required body content to associate an existing entity using collection-valued or single-valued navigation properties.
- <primaryKeyValue>: Mandatory. The primary key value of an entity.
<navigationPropertyValue>: Mandatory. The collection-valued or single-valued navigation property name.
<useCollectionValuedNavigationProperty>: The possible values are true or false. If you are using the collection-valued navigation property to associate an existing entity, then set this property to true. Otherwise, set it to false.
Sample request
Following is a sample REST/JSON request that can be handled by the associateAnExistingEntity
operation.
{ "apiUrl":"https://wso2.crm5.dynamics.com", "accessToken":"eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6IjlGWERwYmZNRlQyU3", "refreshToken":"AQABAAAAAABnfiG-mA6NTae7CdWW7Qfd0aAk9Jh2jERSJt61ivkdC_8VpI4B75AWvtviJErRhnzKIDvt", "clientSecret":"iDJ7gQ81N+JAW9Ql2/ikMzc9og", "clientId":"c12ec5be-8356-ed0915a", "resource":"https://wso21234.crm5.dynamics.com/", "registryPath":"", "intervalTime":"", "entityType":"opportunities", "bodyContent":{"@odata.id":"https://wso21234.crm5.dynamics.com/api/data/v8.2/accounts(334567218-8a4e-fgt561-80f7-c4346bad279c)"}, "primaryKeyValue":"00000000-0000-0000-0000-000000000001", "navigationPropertyValue":"customerid_account", "useCollectionValuedNavigationProperty":"false" }
- For collection-valued navigation property documentation, see https://msdn.microsoft.com/en-us/library/mt607875.aspx#bkmk_Addareferencetoacollection.
- For single-valued navigation property documentation, see https://msdn.microsoft.com/en-us/library/mt607875.aspx#bkmk_Changethereferenceinasingle.
Remove entity reference to collection-valued navigation property
To delete the reference to an entity of a collection-valued navigation property, use the msdynamics365.
removeEntityReferenceForCollectionValuedProperty
.
<msdynamics365.removeEntityReferenceForCollectionValuedProperty> <entityType>{$ctx:entityType}</entityType> <primaryKeyValueOfFirstEntity>{$ctx:primaryKeyValueOfFirstEntity}</primaryKeyValueOfFirstEntity> <primaryKeyValueOfSecondEntity>{$ctx:primaryKeyValueOfSecondEntity}</primaryKeyValueOfSecondEntity> <navigationPropertyValue>{$ctx:navigationPropertyValue}</navigationPropertyValue> <queryParam>{$ctx:queryParam}</queryParam> </msdynamics365.removeEntityReferenceForCollectionValuedProperty>
Properties
- <entityType>: Mandatory. The type of an entity (i.e., accounts, opportunities, contacts etc).
- <primaryKeyValueOfFirstEntity>: Mandatory. The primary key value of an entity.
- <primaryKeyValueOfSecondEntity>: This property is required if you are not using <queryParam> to remove references that use collection-valued navigation property. The primary key value of an entity that has references with another entity.
- <navigationPropertyValue>: Mandatory. The collection-valued navigation property to remove reference to an entity.
<queryParam>: The required query parameters to remove references to an entity using a collection-valued navigation property.
Sample request
Following is a sample REST/JSON request that can be handled by the removeEntityReferenceForCollectionValuedProperty
operation.
{ "apiUrl":"https://wso2.crm5.dynamics.com", "accessToken":"eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6IjlGWERwYmZNRlQyU3", "refreshToken":"AQABAAAAAABnfiG-mA6NTae7CdWW7Qfd0aAk9Jh2jERSJt61ivkdC_8VpI4B75AWvtviJErRhnzKIDvt", "clientSecret":"iDJ7gQ81N+JAW9Ql2/ikMzc9og", "clientId":"c12ec5be-8356-ed0915a", "resource":"https://wso21234.crm5.dynamics.com/", "registryPath":"", "intervalTime":"", "entityType":"accounts", "primaryKeyValueOfFirstEntity":"00000000-0000-0000-0000-000000000001", "navigationPropertyValue":"opportunity_customer_accounts", "queryParam":"$id=https://wso21234.crm5.dynamics.com/api/data/v8.2/opportunities(00000000-0000-0000-0000-000000000001)" }
Remove Entity Reference to Single-Valued Navigation Property
To delete the reference to an entity for a single-valued navigation property, use msdynamics365.removeEntityReferenceForSingleValuedProperty
<msdynamics365.removeEntityReferenceForSingleValuedProperty> <entityType>{$ctx:entityType}</entityType> <primaryKeyValue>{$ctx:primaryKeyValue}</primaryKeyValue> <navigationPropertyValue>{$ctx:navigationPropertyValue}</navigationPropertyValue> </msdynamics365.removeEntityReferenceForSingleValuedProperty>
Properties
- <entityType>: Mandatory. The type of an entity (i.e., accounts, opportunities, contacts etc).
<primaryKeyValue>: Mandatory. The primary key value of an entity.
<navigationPropertyValue>: Mandatory. The single-valued navigation property to remove references to an entity.
Sample request
Following is a sample REST/JSON request that can be handled by the removeEntityReferenceForSingleValuedProperty
operation.
{ "apiUrl":"https://wso2.crm5.dynamics.com", "accessToken":"eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6IjlGWERwYmZNRlQyU3", "refreshToken":"AQABAAAAAABnfiG-mA6NTae7CdWW7Qfd0aAk9Jh2jERSJt61ivkdC_8VpI4B75AWvtviJErRhnzKIDvt", "clientSecret":"iDJ7gQ81N+JAW9Ql2/ikMzc9og", "clientId":"c12ec5be-8356-ed0915a", "resource":"https://wso21234.crm5.dynamics.com/", "registryPath":"", "intervalTime":"", "entityType":"accounts", "primaryKeyValue":"00000000-0000-0000-0000-000000000001", "navigationPropertyValue":"customerid_account" }
For documentation on Delete Reference for Collection-valued or Single-Valued Navigation Property, see https://msdn.microsoft.com/en-us/library/mt607875.aspx#bkmk_Removeareferencetoanentity.
Sample configuration
Given below is a sample proxy service that illustrates how to connect to Microsoft Dynamics 365 with the init
operation and use the associateAnExistingEntity
operation. To view the sample request for this proxy, see Sample Request for the associateAnExistingEntity operation.You can use this sample as a template for the other operations in this category.
<proxy xmlns="http://ws.apache.org/ns/synapse" name="msdynamics_associateAnExistingEntity" transports="https,http" statistics="disable" trace="disable" startOnLoad="true"> <target> <inSequence> <property expression="json-eval($.apiUrl)" name="apiUrl"/> <property expression="json-eval($.accessToken)" name="accessToken"/> <property expression="json-eval($.entityType)" name="entityType"/> <property expression="json-eval($.primaryKeyValue)" name="primaryKeyValue"/> <property expression="json-eval($.apiVersion)" name="apiVersion"/> <property expression="json-eval($.refreshToken)" name="refreshToken"/> <property expression="json-eval($.clientSecret)" name="clientSecret"/> <property expression="json-eval($.clientId)" name="clientId"/> <property expression="json-eval($.resource)" name="resource"/> <property expression="json-eval($.registryPath)" name="registryPath"/> <property expression="json-eval($.intervalTime)" name="intervalTime"/> <msdynamics365.init> <apiUrl>{$ctx:apiUrl}</apiUrl> <accessToken>{$ctx:accessToken}</accessToken> <apiVersion>{$ctx:apiVersion}</apiVersion> <refreshToken>{$ctx:refreshToken}</refreshToken> <clientSecret>{$ctx:clientSecret}</clientSecret> <clientId>{$ctx:clientId}</clientId> <resource>{$ctx:resource}</resource> <registryPath>{$ctx:registryPath}</registryPath> <intervalTime>{$ctx:intervalTime}</intervalTime> </msdynamics365.init> <msdynamics365.associateAnExistingEntity> <entityType>{$ctx:entityType}</entityType> <bodyContent>{$ctx:bodyContent}</bodyContent> <primaryKeyValue>{$ctx:primaryKeyValue}</primaryKeyValue> <navigationPropertyValue>{$ctx:navigationPropertyValue}</navigationPropertyValue> <useCollectionValuedNavigationProperty>{$ctx:useCollectionValuedNavigationProperty}</useCollectionValuedNavigationProperty> </msdynamics365.associateAnExistingEntity> <respond/> </inSequence> <outSequence> <send/> </outSequence> </target> <description/> </proxy>