a!dynAssociate() Function

Associates one object in Dynamics with another, using the given relationship type.

See the Dynamics documentation for the Associate operation for details regarding the parameters and other remarks.

Syntax

a!dynAssociate( scsExternalSystemKey, usePerUserCredentials, endpoint, parameters)

Common Parameters:

scsExternalSystemKey: (Text) The key from the Third Party Credentials admin console page that corresponds to the set of credentials that should be used to authenticate.

usePerUserCredentials: (Boolean) If true the credentials set in the Third-Party Credentials settings page by the current user running the expression will be used. If false the site-wide credential values will be used.

endpoint: (Text) The Dynamics organization endpoint URL. For example, "https://yourcompany.crm4.dynamics.com/XRMServices/2011/Organization.svc".

Specific Parameters:

parameters: (Any Type) The entities to associate, given as a dictionary with fields for EntityName, EntityId (GUID), Relationship, and RelatedEntities.

Returns

Writer

This function returns a writer and must be used with the bind() function.

See also:

Examples

Associate an Opportunity with an Account

Copy and paste the expression into the INTERFACE DEFINITION in EXPRESSION MODE, save it, then call the interface in a Tempo Report to test.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
=load(
  local!accountId,
  local!opportunityId,
  local!dynAssociateWriter: bind(
    null,
    a!dynAssociate(
      scsExternalSystemKey: cons!DYN_SCS_KEY,
      usePerUserCredentials: true,
      endpoint: cons!DYN_ENDPOINT,
      parameters: _
    )
  ),
  {
      a!textField(
        label: "Account ID",
        value: local!accountId,
        saveInto: local!accountId
      ),
      a!textField(
        label: "Opportunity ID",
        value: local!opportunityId,
        saveInto: local!opportunityId
      ),
      a!buttonArrayLayout(
        buttons: {
          a!buttonWidget(
            label: "Associate",
            value: {
              EntityName: "opportunity",
              EntityId: local!opportunityId,
              RelatedEntities: {
                1: {
                  Id: local!accountId,
                  LogicalName: "account",
                  Name: ""
                }
              },
              Relationship: {
                SchemaName: "opportunity_customer_accounts"
              }
            },
            saveInto: local!dynAssociateWriter
          )
        }
      )
  }
)
FEEDBACK