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/.

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 10 Next »

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.

Associate an Existing Entity

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

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.

Sample 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"
 }

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.

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.

Sample 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

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.

Sample 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"
}

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.

Sample Proxy
<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>                          


  • No labels