Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The following operations allow you to work with associate or disassociate entities. Click an operation name to see details on how to use it: Table of ContentsmaxLevel3minLevel3


For a sample proxy service that illustrates how to work with associate entities, see Sample configuration.

Associate an Existing Entity

To add a reference to a collection-valued or single-valued navigation property, use msdynamics365.associateAnExistingEntity.

Code Block
titleassociateAnExistingEntity
<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.

Anchor
request
request
Sample request

Following is a sample REST/JSON request that can be handled by the associateAnExistingEntity operation.

Code Block
languagexml
titleSample Request for Associate An Existing Entity
{
       	"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"
 }
Info

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.

Code Block
titleremoveEntityReferenceForCollectionValuedProperty
<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.

Code Block
languagexml
titleSample Request for Delete Reference for Collection-Valued Property
{
           	"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

Code Block
titleremoveEntityReferenceForSingleValuedProperty
<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.

Code Block
languagexml
titleSample Request for Delete Reference for a Single-Valued Navigation Property
{
           	"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"
}
Info

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.

...