VOOZH about

URL: https://www.cdata.com/kb/tech/dynamicscrm-cloud-salesforce-external-services.rst

⇱ Connect to Dynamics CRM Data through External Services in Salesforce


Connect to Dynamics CRM Data through External Services in Salesforce

πŸ‘ Jerod Johnson
Jerod Johnson
Director, Technology Evangelism
Use CData Connect AI to securely connect Salesforce External Services with Dynamics CRM Data using OpenAPI, exposing APIs to enable streamlined integration and secure, scalable, real-time data sharing across platforms.

CData Connect AI, enables you to access Dynamics CRM data from cloud-based applications like the Salesforce and mobile applications like the Salesforce Mobile App. In this article, you will use CData Connect AI to access Dynamics CRM data through Salesforce External Services.

About Dynamics CRM Data Integration

CData simplifies access and integration of live Microsoft Dynamics CRM data. Our customers leverage CData connectivity to:

  • Read and write data in the Dynamics CRM 2011+ Services and Dynamics CRM Online.
  • Extend the native features of Dynamics CRM with customizable caching and intelligent query aggregation and separation.
  • Authenticate securely with Dynamics CRM in a variety of ways, including Azure Active Directory, Azure Managed Service Identity credentials, and Azure Service Principal using either a client secret or a certificate.

CData customers use our Dynamics CRM connectivity solutions for a variety of reasons, whether they're looking to replicate their data into a data warehouse (alongside other data sources) or analyze live Dynamics CRMa data from their preferred data tools inside the Microsoft ecosystem (Power BI, Excel, etc.) or with external tools (Tableau, Looker, etc.).


Getting Started


Connect to Dynamics CRM from Salesforce

Overview

Here is an overview of the steps:

  1. Configure: (Optional) Set up your Dynamics CRM data source in CData Connect AI, add a Workspace, add assets to your Workspace, and generate a Personal Access Token (PAT).
  2. Connect: Link Salesforce to CData Connect AI using OpenAPI.
  3. Explore: Use your connected data in Salesforce.

Prerequisites

Ensure you have the following before starting:

  1. An active Dynamics CRM account and credentials.
  2. A CData Connect AI account. Log in or sign up for a free trial here.
  3. A Salesforce account.


Connect to Dynamics CRM from Connect AI

CData Connect AI uses a straightforward, point-and-click interface to connect to data sources.

  1. Log into Connect AI, click Sources, and then click Add Connection
  2. πŸ‘ Adding a Connection
  3. Select "Dynamics CRM" from the Add Connection panel
  4. πŸ‘ Selecting a data source
  5. Enter the necessary authentication properties to connect to Dynamics CRM.

    The connection string options meet the authentication and connection requirements of different Dynamics CRM instances. To connect to your instance, set the User and Password properties, under the Authentication section, to valid Dynamics CRM user credentials and set the Url to a valid Dynamics CRM server organization root. Additionally, set the CRMVersion property to 'CRM2011+' or 'CRMOnline'. IFD configurations are supported as well; set InternetFacingDeployment to true.

    Additionally, you can provide the security token service (STS) or AD FS endpoint in the STSURL property. This value can be retrieved with the GetSTSUrl stored procedure. Office 365 users can connect to the default STS URL by simply setting CRMVersion.

    πŸ‘ Configuring a connection (Salesforce is shown)
  6. Click Save & Test
  7. Navigate to the Permissions tab in the Add Dynamics CRM Connection page and update the User-based permissions. πŸ‘ Updating permissions

Add a Personal Access Token

When connecting to Connect AI through the REST API, the OData API, or the Virtual SQL Server, a Personal Access Token (PAT) is used to authenticate the connection to Connect AI. It is best practice to create a separate PAT for each service to maintain granularity of access.

  1. Click on the Gear icon () at the top right of the Connect AI app to open the settings page.
  2. On the Settings page, go to the Access Tokens section and click Create PAT.
  3. Give the PAT a name and click Create. πŸ‘ Creating a new PAT
  4. The personal access token is only visible at creation, so be sure to copy it and store it securely for future use.

Configure Dynamics CRM Endpoints for Salesforce

After connecting to Dynamics CRM, create a workspace for your desired table(s).

  1. Navigate to the Workspaces page and click Add to create a new Workspace (or select an existing workspace). πŸ‘ The Workspaces page.
    πŸ‘ Adding a new Workspace.
  2. Click Add to add new assets to the Workspace.
  3. Select the Dynamics CRM connection (e.g. DynamicsCRM1) and click Next. πŸ‘ Selecting an Asset (Salesforce is shown).
  4. Select the table(s) you wish to work with and click Confirm. πŸ‘ Selecting Tables (Salesforce is shown).
  5. Make note of the OpenAPI URL for your workspace, e.g. https://cloud.cdata.com/api/openapi/v3/{workspace_name}...

Check the column data types of the selected table:

  1. Once the Dynamics CRM data table is added as an asset, select the asset, and note the column names and data types from the Columns tab. πŸ‘ Note the column names and data types
  2. In the Preview tab, preview the current data in the table to be referenced later. πŸ‘ Preview the current data
  3. Click on Users from the left panel and search for your username, e.g. [email protected]. Click on the same.
  4. On the Edit Users screen, grant the respective user all Permissions (Select, Insert, Update, Delete, and Execute) for the entity (workspace).

With the connection, PAT, and Workspace configured, you are ready to connect to Dynamics CRM data from Salesforce.

Connect to Dynamics CRM Data as an External Service

Create a Named Credential

Follow the steps below to connect to the OpenAPI produced by CData Connect AI with Salesforce:

  1. Log into Salesforce and navigate to Setup. πŸ‘ Log into Salesforce and open Setup
  2. Search for Named Credentials in the search bar and click on it. πŸ‘ Search Named Credentials
  3. Select New -> New Legacy. πŸ‘ Select New Legacy
  4. Add the given details in the New Named Credential screen:
    • Label: enter a label of your choice
    • Name: enter a name for the named credential
    • URL: https://cloud.cdata.com
    • Identity Type: Named Principal
    • Authentication Protocol: Password Authentication
    • Username: enter your CData Connect AI username. This is displayed in the top-right corner of the CData Connect AI interface. For example, [email protected]
    • Password: enter the PAT you generated on the Settings page
    • Generate Authorization Header: enable the checkbox
  5. Click Save to save the details.

    πŸ‘ Save the Named Credential details

Create an External Service

  1. Now, search for External Services in the search bar and click on it. πŸ‘ Search for External Services
  2. In the Add an External Service page, click From API Specification under Select an API Source. πŸ‘ Click "From API Specification"
  3. In the Enter an Existing Service page, enter the given details under Modify Exiting Registration Details:
    • External Service Name: enter an identifying name for your external service
    • Description: enter a description of your external service (not a mandatory field)
    • Service Schema: Relative URL
    • Select a Named Credential: OpenAPI
    • URL: copy the OpenAPI URL from Connect AI and remove https://www.cdata.com and keep the rest of the URL. Make sure the URL starts with a forward slash "/api...".
    πŸ‘ Enter the External Service details

    If the connection is successful, the message "Schema validation completed successfully!" will be displayed on the screen. Click Save & Next

  4. Select all the entities in the Select Operations screen. Click Next. πŸ‘ Select all the Operations entities
  5. All the schema-generated actions are displayed in the Review External Services Actions screen. Click Finish. πŸ‘ Review External Services actions
  6. The External Services page will display all the external services created. πŸ‘ Page displaying all external services

Create a new Flow

  1. Search for Flows in the search bar and click on it.
  2. Click New Flow. πŸ‘ Click New Flow
  3. Select Start From Scratch option and click Screen Flow. πŸ‘ Start from scratch
    πŸ‘ Start screen flow
  4. In the Flow Builder screen, click on the "" between Screen Flow and End.
  5. Select Screen from Add Element. πŸ‘ Add a screen
  6. In the New Screen window, enter "Input Screen" in Label and the API Name will be auto-filled accordingly. πŸ‘ Enter Input Screen in the Label
  7. Next, based on the table you want to update, note the column data types to add the components to the flow.
  8. Now, for the orderid column, search for the "Number" component in the Components search bar and click on it. Enter Label as "Enter Order ID" and again API Name will be auto-filled accordingly. Enable the Require checkbox and apply this for steps 9 and 10. πŸ‘ Add the Order ID label
  9. For the ordername column, search for the "Text" component in the Components search bar and click on it. Enter Label as "Enter Order Name". πŸ‘ Add the Order Name label
  10. For the personid column, search for the "Number" component in the Components search bar and click on it. Enter Label as "Enter Person ID". πŸ‘ Add the Person ID label
  11. Click Done and Input Screen will be added in the Flow Builder. πŸ‘ Click Done
  12. Now, add an element Action below the input screen in the flow. πŸ‘ Add the Action element
  13. Under Search Actions, search and click the newly created external service, in this case, OpenAPI1. πŸ‘ Search the newly created external services
  14. Click Create Orders. πŸ‘ Create Orders
  15. Enter a name in Label, the API Name gets auto filled. πŸ‘ Enter a name in the label
  16. Click on the search bar under Set Input Values for the Selected Action and select New Resource -> Variable. πŸ‘ Select New Resource
    πŸ‘ Select Variable
  17. In the New Resource window, enter the following details:
  18. Add a new element Assignment and add the Label name as "SendBody". Again, the API Name gets auto-filled. πŸ‘ Add a new element "Assignment"
  19. Set the given values under Set Variable Values:
    • Variable: Body>orderid; Operator: Equals; Value: Input Screen>Enter Order ID
    • Variable: Body>ordername; Operator: Equals; Value: Input Screen>Enter Order Name
    • Variable: Body>personid; Operator: Equals; Value: Input Screen>Enter Person ID
    πŸ‘ Click variable "Body"
    πŸ‘ Click Order ID
    πŸ‘ Select the value as Enter Order ID
    πŸ‘ Fill all the three variable values as shown
  20. Add another Screen element below the Action element. πŸ‘ Add a new screen element
  21. Name the Label as "Display". πŸ‘ Name the label as "Display"
  22. Under Components, search for the "Display Text" component and click on it.
  23. Set the API Name as "Display_Result" and in the Inside a resource search bar, select Create a new order -> response code. Click Done. πŸ‘ Search "Display Text" and add an API name
    πŸ‘ Searh the action "Create a new order" and click "responseCode"
    πŸ‘ Click Done
  24. The flow is now ready. Click Save to save the flow and add a name to the Label as the flow name, in this case, "CreateOrdersPage". Click Save. πŸ‘ Click Save to save the flow
    πŸ‘ Add a flow name in the label
  25. The flow is displayed on the Flow Builder screen. Click on Activate to activate the flow. πŸ‘ The flow is displayed on the flow builder. Click Activate
    πŸ‘ The flow is activated

Check the flow and verify the updated details in Connect AI

  1. Click Debug. The Debug flow window opens. Click Run. πŸ‘ Click Debug
  2. In the details input page, in this case, "CreateOrdersPage", enter the details (Orders ID, Orders Name, and Person ID) and click Next. πŸ‘ Enter the details to be edited in the Dynamics CRM table
  3. The next page displays the message "200" (HTTP 200 - OK) and the right pane displays the debug details. Click Next. πŸ‘ The page diplays a HTTP 200 OK message to show the entry success
  4. You can change the inputs or run the process again to enter new details. πŸ‘ You can change the inputs and run the flow again
  5. Check in Connect AI if the new details are updated in the "Orders" table, as this article outlines. This completes the process.

Simplified access to Dynamics CRM data from cloud applications

At this point, you have a direct, cloud-to-cloud connection to live Dynamics CRM data from Salesforce. For more details on accessing live data from over 100 SaaS, Big Data, and NoSQL sources through cloud applications, visit our CData Connect AI page.

Reach out to our Support Team if you have any questions.