Dynamics

Microsoft Dynamics is a line of data management tools typically used for customer relationship management (CRM); they also provide a suite of enterprise resource planning (ERP) applications.

Skuid provides a pre-configured Microsoft Dynamics data source type, making it easier to access Dynamics CRM data within your Skuid pages. To use it, you’ll need to do three things:

  1. Create a Microsoft Dynamics app and acquire OAuth credentials.
  2. Set up a new authentication provider for Microsoft Dynamics in Skuid.
  3. Use those OAuth credentials to set up a new data source in Skuid.

Once that’s completed, you can use Microsoft Dynamics as a data source to create models and read/write your Dynamics CRM data within Skuid.

Data Source-Specific Properties

Data Source User Attributes:

  • Roles: Allows the roles assigned to the user in Dynamics to be used as a model condition.

Configuration

Using the OAuth credentials created in your Azure Active Directory app registration, complete the following two steps to use the Dynamics data source type:

  1. Create the Dynamics authentication provider.
  2. Create the Dynamics data source.

Authentication provider

  1. Navigate to Configure > Authentication Providers.

  2. Click New Authentication Provider.

  3. In the New Authentication Provider window, give the new provider a name.

  4. Authentication Method: select OAuth 2.0 / OpenID.

  5. OAuth Configuration:

    • Provider Type: Other.

      Note

      Once you select this, the Authorize Endpoint URL and the Token Endpoint URL fields will clear.

    • Grant Type: Authorization Code.

    • Authorize Endpoint URL: https://login.windows.net/common/oauth2/authorize?resource=https://<Organization Name>.crm.dynamics.com

      Note

      The resource section of the endpoint URL should look similar to the URL used to access your Dynamics instance.

    • Token Endpoint URL: https://login.windows.net/common/oauth2/token

    • Default Scopes: Whether scopes are required, and which ones, will vary depending upon the configuration of your Dynamics service. Work with your IT administrator to determine what values to put in this field.

  6. For Client Credentials, use the client ID and client secret for your Azure Active Directory app registration.

  7. Click Save.

You may be asked to if you want Skuid to create Remote Site Settings. If so, click Okay. (Otherwise, you will need to configure these manually, to allow Skuid to communicate with Microsoft Dynamics.)

Data Source

Now to add Microsoft Dynamics as a data source for your Skuid pages.

  1. Navigate to Configure > Data Sources.

  2. Click New Data Source.

  3. For Data Source Type, select MicrosoftDynamics.

  4. Enter a name for the new data source.

  5. Click Next Step.

  6. In Step 2: Enter MS Dynamics Environment Details, add the following.

    • Product Version: choose the version of Dynamics CRM/365 being run by your company:

      • Online
      • On Premise
      • Note: If you are unsure, ask your IT administrator.
    • Organization Name: Add your organization’s name.

    • Organization URL: When you add the Organization Name (above), this will automatically populate the URL in the following format: https://<Organization Name>.crm.dynamics.com. This URL should look similar to the URL used to access your Dynamics instance.

      Note

      With some versions of Microsoft Dynamics, you can use a URL or an IP address.

    • Service Endpoint: Once the Company name and URL are entered, Skuid automatically determines the service endpoint, based on the options you selected.

      Note

      You may not edit this field directly.

  7. Click Next Step.

  8. Select the Authentication Provider you just created for Microsoft Dynamics.

  9. Click Save New Data Source.

Troubleshooting

When configuring Microsoft data sources, several common errors may deal with authentication and data source configuration. If you receive errors when logging into the OAuth popup window, check the following:

  1. The authentication provider’s authorize endpoint URL contains your Office365 domain name.
  2. The client ID and client secret match the application ID and a key from your app registration
  3. Ensure that you are not logging into to another (different) Office365 account. Switching accounts will cause issues with cookies and not allow you to properly authenticate, especially if the accounts are in two separate Office365 domains.

There are several specific errors you may encounter:

  • Data source and app registration scopes have been updated, but the end user can’t access data from Skuid.

    The changes to permissions may have not had enough time to propagate in Microsoft’s servers. Try again later.

  • This application requires application permissions to another application. Consent for application permissions can only be performed by an administrator. Sign out and sign in as an administrator or contact one of your organization's administrators.

    There is an issue with your application registration permissions. Ensure you have set your permissions as Application Permissions instead of Delegation Permissions.

  • Could+not+find+the+authenticating+server,+https://login.microsoftonline.com/common/oauth2/token

    This error message indicates issues with your OAuth authentication flow.

    Try each of the following steps in turn:

    1. If logging in with multiple Office365 accounts, or using an account without the appropriate licenses, try clearing the cookies.
    2. Check that your client ID and client secret have been entered correctly in the authentication provider. If you’ve lost your client secret, create a new key in your Azure AD app registration and update the authentication provider.
    3. Delete the Skuid data source and recreate it, pointing to the same authentication provider.
    4. If all else fails, delete any and all existing data sources and authentication providers for the Microsoft service you’re configuring and then recreate them.
  • I see Invalid Request: Exceeded max size limit of 6000000 when choosing a model object.

    If you’re using an Apex proxy, the response from your Dynamics endpoint is still subject to Salesforce heap size limits, hence this error. To resolve this you must disable the Apex proxy:

    • In the Skuid UI, navigate to Configure > Data Sources.
    • Click fa-cogs Edit beside the Dynamics data source encountering this error.
    • Uncheck Use Apex Proxy.

    Note

    Doing this may not conform to your security priorities. Concerns about heap size limits should be balanced with your security policies and security best practices.

  • I see an Http request failed error when viewing the page in Salesforce Lightning.

    This indicates that the external site being accessed by the data sources is not added to Salesforce’s CORs and CSP settings. Ensure the data source’s endpoint is added to both of these settings:

Common authentication errors

  • ADSTS650057:+Invalid+resource.+The+client+has+requested+access+to+a+resource+which+is+not+listed+in+the+requested+permissions+in+the+client's+application+registration.+Client+app+ID:+91f52f36-0067-42a4-aa88-4fba19fdfbbb(<My App Registration>).+Resource+value+from+request:+https://<My Organization>.api.crm.dynamics.com/.+Resource+app+ID:+00000007-0000-0000-c000-000000000000.+List+of+valid+resources+from+app+registration:+00000003-0000-0000-c000-000000000000.

    This error indicates the appropriate API permissions have not been granted to the app registration.

  • AADSTS50001: Resource identifier is not provided.

    Your authentication provider’s Authorize Endpoint URL may not be set correctly. Ensure that the organization name in the resource URL parameter is set correctly.

    For example, an organization named example would use:

    https://login.windows.net/common/oauth2/authorize?resource=https://example.crm.dynamics.com