Umbraco DXP
CMSCloudHeartcoreMarketplace
  • Umbraco DXP
  • Sustainability Best Practices
  • Commercial products
    • Umbraco Forms
    • Umbraco Deploy
    • Umbraco Workflow
    • Umbraco Commerce
    • Umbraco UI Builder
    • Umbraco Engage
    • Commercial Products, Relations and dependencies
  • Marketplace
    • Introduction
    • Listing Your Package
    • Package Telemetry Data
  • Packages
    • Authorized Services
    • Storage Providers
  • Integrations
    • Categories
    • ActiveCampaign
    • ActiveCampaign with Umbraco Forms
    • Algolia
    • Aprimo
    • CookieBot
    • CommerceTools
    • Dynamics
    • emerchantpay with Umbraco Forms
    • Google Search Console
    • HubSpot
    • HubSpot with Umbraco Forms
    • inriver
    • Semrush
    • Shopify
    • Zapier
    • Zapier with Umbraco Forms
Powered by GitBook
On this page
  • Package Links
  • Minimum version requirements
  • Authentication
  • Additional Configuration
  • Self Hosted OAuth Configuration
  • Backoffice usage
  • Front-end rendering

Was this helpful?

Edit on GitHub
Export as PDF
  1. Integrations

Dynamics

Details an integration available for Dynamics, built and maintained by Umbraco HQ.

PreviousCommerceToolsNextemerchantpay with Umbraco Forms

Last updated 2 months ago

Was this helpful?

This integration provides a form picker and rendering component for forms managed within a Microsoft Dynamics 365 Marketing instance.

Package Links

Minimum version requirements

To ensure compatibility, check the Dependencies tab on NuGet for the required Umbraco CMS version. For example, see .

Authentication

The package uses the OAuth protocol for authentication.

Additional Configuration

To connect to your Dynamics 365 instance, the following configuration is required:

appsettings.json
"Umbraco": {
  "Integrations": {
      "Crm": {
        "Dynamics": {
          "Settings": {
            "HostUrl": "https://[INSTANCE].crm4.dynamics.com/",
            "ApiPath": "api/data/v9.2/"
          }
        }
      }
    }
  }
web.config
<appSettings>
  ...
  <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/" />
  ...
</appSettings>

The above settings are for demonstration purposes. They might change depending on your personalized instance Web API.

Self Hosted OAuth Configuration

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:

appsettings.json
"Umbraco": {
  "CMS": {
    "Integrations": {
      "Crm": {
        "Dynamics": {
          "Settings": {
            ...
            "UseUmbracoAuthorization": true/false
          },
          "OAuthSettings": {
              "ClientId": "[your client id]",
              "ClientSecret": "[your client secret]",
              "RedirectUri": "https://[your website base URL]/umbraco/api/dynamicsauthorization/oauth",
              "TokenEndpoint": "https://login.microsoftonline.com/common/oauth2/v2.0/token",
              "Scopes": "https://[your instance].crm4.dynamics.com/.default"
            }
        }
      }
    }
  }
}
web.config
<appSettings>
  ...
  <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" />
</appSettings>

The authorization mode is toggled by the UseUmbracoAuthorization flag, which by default is set to true meaning that previous versions of the integration are not impacted.

The used service is provided using the AuthorizationImplementationFactory method, depending on the type of authorization selected.

The authorization controller uses the window.postMessage interface for cross-window communications when redirecting from the Microsoft authorization server.

Backoffice usage

To use the form picker, a new Data Type needs to be created based on the Dynamics Form Picker property editor.

The settings in Web.config/appsettings.json will 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.

Front-end rendering

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:

@using Umbraco.Cms.Integrations.Crm.Dynamics.Helpers;

Assuming a property based on the created Data Type with the alias dynamicsForm has been created, render the form using:

@Html.RenderDynamicsForm(Model.DynamicsForm)

The selected form is embedded either through an iframe or by using scripts.

The authorization specific methods are exposed by the and implemented by two services:

If you are selecting your own authorization flow that uses the AuthorizationService, the redirect URL will be this one: /umbraco/api/dynamicsauthorization/oauth, from . Make sure to set to correct URL in the settings of the website and in the configuration for your Dynamics app.

NuGet install
Source code
Umbraco marketplace listing
Umbraco.Cms.Integrations.Crm.Dynamics
IDynamicsAuthorizationService
UmbracoAuthorizationService
AuthorizationService
DynamicsAuthorizationController