Dynamics 365 Connector

Integrate with Microsoft Dynamics 365 for CRM and ERP operations

Microsoft Dynamics 365 Connector

Integrate your workflows with Microsoft Dynamics 365 and automate your CRM and ERP processes. Create leads, manage customer accounts, track opportunities, and process business transactions seamlessly.

Overview

The Dynamics 365 connector provides 9 operations for managing your customer and business data. Whether you're a sales team automating pipeline management or an operations team processing orders, this connector connects you to the entire Dynamics ecosystem.

Authentication

Dynamics 365 uses Azure AD (Active Directory) for authentication. You'll set up an application registration in Azure and grant it access to your Dynamics instance.

auth_type: oauth2
tenant_id: "your-tenant-id"
client_id: "your-app-id"
client_secret: "your-client-secret"
resource_url: "https://your-org.crm.dynamics.com"

How to set it up:

  1. Go to Azure Portal > Azure Active Directory > App registrations
  2. Click New registration
  3. Name it "DeepChain Connector"
  4. Copy the Application (client) ID and Directory (tenant) ID
  5. Under Certificates & secrets, create a new Client secret
  6. In API permissions, add permissions for Dynamics (Dynamics CRM > user_impersonation)
  7. Grant admin consent

Available Operations

Here's what you can manage:

Accounts (Companies)

Operation What It Does
getAccount Fetch an account by ID
createAccount Create a new account
updateAccount Update account details
listAccounts List accounts with filtering

Contacts (People)

Operation What It Does
getContact Fetch a contact by ID
createContact Create a new contact
updateContact Update contact information

Leads (Prospects)

Operation What It Does
getLead Fetch a lead by ID
createLead Create a new lead
qualifyLead Move lead through qualification

Practical Workflow Examples

Example 1: Auto-Create Lead from Web Form

Capture web form submissions and turn them into Dynamics leads:

- id: create_lead
  type: dynamics365_connector
  config:
    operation: createLead
    firstname: "{{ input.first_name }}"
    lastname: "{{ input.last_name }}"
    emailaddress1: "{{ input.email }}"
    telephone1: "{{ input.phone }}"
    companyname: "{{ input.company }}"
    leadsourcecode: 1  # 1 = Web form (check your Dynamics options)
    description: "Source: {{ input.form_url }}"

Example 2: Qualify a Lead

Move a lead forward in your process when they become qualified:

- id: qualify_lead
  type: dynamics365_connector
  config:
    operation: qualifyLead
    leadId: "{{ input.lead_id }}"
    createAccount: true
    createContact: true
    createOpportunity: true
    opportunityName: "{{ input.lead_name }} - Opportunity"

Example 3: Create Account and Add Contact

Set up a new company account and immediately add the primary contact:

- id: create_account
  type: dynamics365_connector
  config:
    operation: createAccount
    name: "{{ input.company_name }}"
    industrycode: "{{ input.industry_code }}"  # Check your picklist
    websiteurl: "{{ input.website }}"
    telephone1: "{{ input.phone }}"

- id: add_contact
  type: dynamics365_connector
  config:
    operation: createContact
    firstname: "{{ input.contact_first_name }}"
    lastname: "{{ input.contact_last_name }}"
    emailaddress1: "{{ input.contact_email }}"
    parentcustomerid: "{{ create_account_1.response.id }}"
    jobtitle: "{{ input.title }}"

Example 4: List Accounts with Filtering

Find all accounts in a specific region:

- id: list_accounts
  type: dynamics365_connector
  config:
    operation: listAccounts
    filter: "address1_stateorprovince eq '{{ input.state }}'"
    select:
      - name
      - accountid
      - address1_city
      - primarycontactid
    pagesize: 50

Example 5: Update Lead Status

Move leads to different stages as they progress:

- id: update_lead
  type: dynamics365_connector
  config:
    operation: updateContact
    contactId: "{{ input.lead_id }}"
    statuscode: "{{ input.new_status }}"  # 1 = Open, 2 = Contacted, 3 = Qualified, etc.
    leadqualifyingprocess: "{{ input.process_id }}"  # If using BPF

Rate Limits

Dynamics 365 rate limits vary by license type and organization settings:

  • Typically: 6,000 API requests per 5 minutes per user
  • Organization: 60,000 API requests per 5 minutes per organization

Note: DeepChain handles throttling automatically. If you hit limits, we'll retry with backoff.

Error Handling

Common Dynamics 365 Errors

Error What It Means How to Fix
InvalidOperation Operation not allowed on this entity Check that the entity supports this operation
ObjectNotFound Record doesn't exist Verify the record ID and entity type
InvalidAttributeValue Field value doesn't match picklist options Use exact values from Dynamics
RequiredFieldMissing Didn't provide a required field Check entity's required fields in Dynamics
Unauthorized Credentials invalid or permissions lacking Check Azure AD app permissions

Debugging

Enable debug logging:

Node Configuration:
  debug: true
  logRequest: true
  logResponse: true

Check execution logs for exact API error messages from Dynamics.

Best Practices

1. Always Test in Sandbox First

Use a Dynamics sandbox organization before going to production:

# Development
resource_url: "https://org-sandbox.crm.dynamics.com"

# Production
resource_url: "https://org.crm.dynamics.com"

2. Use Correct Picklist Values

Many fields use option sets (picklists). Use the exact values:

# These are examples—yours may differ
industrycode: 1  # Technology, 2 = Manufacturing, etc.
leadsourcecode: 1  # Web form
statuscode: 1  # Open

Check your Dynamics picklist values in Settings > Customizations.

3. Link Records with Parent IDs

When creating records, always link them to parent records:

- id: create_contact
  type: dynamics365_connector
  config:
    operation: createContact
    firstname: "{{ input.first_name }}"
    parentcustomerid: "{{ input.account_id }}"  # Link to account

4. Handle Business Process Flows (BPF)

If using Business Process Flows, move leads through them:

- id: advance_process
  type: dynamics365_connector
  config:
    operation: updateLead
    leadId: "{{ input.lead_id }}"
    leadqualifyingprocess: "{{ input.bpf_id }}"
    # Also update the stage
    processstage: "Prospecting"

5. Batch Operations When Possible

Process multiple records efficiently:

- id: list_leads
  type: dynamics365_connector
  config:
    operation: listLeads
    filter: "statuscode eq 1"
    select:
      - leadid
      - firstname
      - lastname

- id: loop
  type: loop
  items: "{{ list_leads_1.response }}"

- id: update_each
  type: dynamics365_connector
  config:
    operation: updateLead
    leadId: "{{ loop_1.current.leadid }}"
    statuscode: 2  # Mark as contacted

Next Steps