Details an integration available for Dynamics, built and maintained by Umbraco HQ.
This integration provides a form picker and rendering component for forms managed within a Microsoft Dynamics 365 Marketing instance.
The package uses the OAuth protocol for authentication.
To connect to your Dynamics 365 instance, the following configuration is required:
Versions 9 and above
<add key="Umbraco.Cms.Integrations.Crm.Dynamics.HostUrl" value="https://[INSTANCE]/api.crm4.dynamics.com/" />
<add key="Umbraco.Cms.Integrations.Crm.Dynamics.ApiPath" value="api/data/v9.2/" />
The above settings are for demonstration purposes. They might change depending on your personalized instance Web API.
The easiest way to configure the integration is to make use of an application Umbraco has pre-configured with Microsoft. With this in place, the authorization flow will go through a proxy website Umbraco maintains before redirecting back to your Umbraco backoffice.
From version 1.2.0, we introduced an alternate approach that requires a little more setup. It removes the need for relying on any services from Umbraco when using the integration.
To use this you need to setup your own app with Microsoft and use an extended configuration like this:
Versions 9 and above
"ClientId": "[your client id]",
"ClientSecret": "[your client secret]",
"RedirectUri": "https://[your website base URL]/umbraco/api/dynamicsauthorization/oauth",
"Scopes": "https://[your instance].crm4.dynamics.com/.default"
<add key="Umbraco.Cms.Integrations.Crm.Dynamics.UseUmbracoAuthorization" value="true/false" />
<add key="Umbraco.Cms.Integrations.Crm.Dynamics.ClientId" value="[your client id]" />
<add key="Umbraco.Cms.Integrations.Crm.Dynamics.ClientSecret" value="[your client secret]" />
<add key="Umbraco.Cms.Integrations.Crm.Dynamics.RedirectUri" value="https://[your website base URL]/umbraco/api/dynamicsauthorization/oauth" />
<add key="Umbraco.Cms.Integrations.Crm.Dynamics.TokenEndpoint" value="https://login.microsoftonline.com/common/oauth2/v2.0/token" />
<add key="Umbraco.Cms.Integrations.Crm.Dynamics.Scopes" value="https://[your instance].crm4.dynamics.com/.default" />
The authorization mode is toggled by the
UseUmbracoAuthorizationflag, which by default is set to
truemeaning that previous versions of the integration are not impacted.
The authorization specific methods are exposed by the
IDynamicsAuthorizationServiceand implemented by two services:
The used service is provided using the
AuthorizationImplementationFactorymethod, depending on the type of authorization selected.
If you are selecting your own authorization flow that uses the
AuthorizationService, the redirect URL will be this one:
DynamicsAuthorizationController. Make sure to set to correct URL in the settings of the website and in the configuration for your Dynamics app.
The authorization controller uses the
window.postMessageinterface for cross-window communications when redirecting from the Microsoft authorization server.
To use the form picker, a new Data Type needs to be created based on the Dynamics Form Picker property editor.
The settings in
appsettings.jsonwill be used for sending authorization and data requests to the Dynamics API, through the 0Auth Proxy for Umbraco Integrations or directly.
The Connect button prompts the user with the Microsoft authorization window, which after a successful authentication will send the authorization code back.
The retrieved access token will be saved into the database and used for future requests.
Revoke action will remove the access token from the database and the authorization process will need to be repeated.
A strongly typed model will be generated by the property value converter. An HTML helper is available to render the form on the front end.
Ensure your template has a reference to the following using statement:
Assuming a property based on the created Data Type with the alias
dynamicsFormhas been created, render the form using:
The selected form is embedded either through an iframe or by using scripts.