Microsoft Dynamics 365
Follow the below steps to connect to the Microsoft Dynamics 365 API.
Ensure you have Azure administrator access or an Azure administrator is able to grant permissions to the application. This is required to approve the application in Microsoft Dynamics 365.
Step 1. Create the Integration
- Navigate to Formie → Settings → CRM.
- Click the New Integration button.
- Select Microsoft Dynamics 365 as the Integration Provider.
Step 2. Connect to the Microsoft Dynamics 365 API
- Go to Azure Active Directory Admin Center and login to your account.
- Click on the Azure Active Directory in the left-hand sidebar, App Registrations then New Registration.
- Under Supported account types select Accounts in any organizational directory (Any Azure AD directory - Multitenant) and personal Microsoft accounts (e.g. Skype, Xbox).
- In the Redirect URI field, enter the value from the Redirect URI field in Formie.
- Click the Register button.
- Copy the Application (client) ID from Microsoft Dynamics 365 and paste in the Client ID field in Formie.
- Click on the Certificates & Secrets in the left-hand sidebar.
- Click the New client secret button and provide a name and appropriate expiry.
- Copy the Value from Microsoft Dynamics 365 for the resulting secret and paste in the Client Secret field below.
- Click on the API Permissions in the left-hand sidebar.
- Click the Add a Permission button.
- Select Microsoft Graph, then the Delegated permissions option and select the following permissions:
emailoffline_accessopenidprofile
- Click Add Permissions.
- Navigate back to All APIs and select Dynamics CRM and select the following permissions:
user_impersonation
- Click Add Permissions.
- Navigate back to API Permissions and click the Grant Admin Consent button, and agree to the prompt.
Step 3. Create an Application User
- Go to Power Platform Admin Center and login to your account as a System Administrator.
- Click Environments in the left-hand sidebar, and then select an environment from the list.
- Copy the Environment URL from Power Platform and paste in the Domain field in Formie. Be sure to include the
https://(e.g.https://ffcor.crm6.dynamics.com). - Click the Settings button in the top navigation.
- Click Users + Permissions, and then click Application Users.
- Click the + New app user button in the top navigation.
- Click + Add an app to choose the registered Azure AD application that was created for the selected user, and then click the Add button.
- Select a business unit from the dropdown list for Business Unit.
- Click Security roles and add the following:
Basic User
- Click the Save button, then the Create button.
Step 4. Test Connection
- Save this integration.
- Click on the Connect button in the right-hand sidebar.
- You‘ll be redirected to Microsoft Dynamics 365, where you must approve Formie to access your Microsoft Dynamics 365 account.
Step 5. Form Setting
- Go to the form you want to enable this integration on.
- Click the Integrations tab.
- In the left-hand sidebar, select the name you gave the integration.
- Enable the integration and fill out all required fields.
- Click Save to save the form.
Optional: Web API version
The Microsoft Dynamics 365 Web API provides different versions of the Web API (opens new window). This is to both maintain compatibility or implement new breaking changes. There are no major differences between v9.0, v9.1 or v9.2 currently. This setting allows you to specify a specific API version if required. When setting a specific value, all Microsoft Dynamics 365 Web API requests will use this API version in the request URI.
For compatibility, the default setting is v9.0. This has been the value used in the Microsoft Dynamics 365 CRM integration prior to this being customisable.
Optional: Impersonate user
When CRM records are created through Formie the user context of the account used to authenticate the OAuth connection is used (this is different to the application user). Depending on requirements, you may wish to override this. The easiest option is to authenticate under the account you wish to have records created by as, however this may not always be possible.
Using user impersonation you can set another systemuser context instead without changing the OAuth connection.
Impersonation settings:
- Impersonate user - Toggle the entire feature on or off.
- Impersonate header - This sets the HTTP header to either
CallerObjectIdorMSCRMCallerID. Depending on your environment one or the other will need to be used relative to the user ID provided. - Impersonate User ID - This is the GUID of a valid systemuser within your Microsoft Dynamics 365 CRM.
When enabled this will be applied to all Microsoft Dynamics 365 CRM enabled forms.
By setting the impersonate HTTP header, this will also populate the Created By (delegate) field to the actual user context to provide a more accurate audit trail.
If you want to selectively control the "Created" By value on records per form, use the Created By field in the mapping.
Note: The impersonate user feature is set via a HTTP header on POST requests which will override any Created By field mapping that is set.