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.

Metadata Caching

Metadata explains the structure of your data to Skuid. And because it’s such an essential part of the data model, metadata is unlikely to change after initial set up. However, Skuid must still query for metadata at every page load.

As an alternative, it is possible to cache, or save, the metadata of Dynamics data sources for future use instead of downloading it on each page load. Doing so can lead to noticeable performance improvements.

Note

  • Metadata caching for this data source type is currently exclusive to Skuid Platform.
  • You must refresh your metadata cache manually if your Dynamics schema changes.

Enable metadata caching

  1. Navigate to Configure > Data Sources > Data Sources.
  2. Beside any Dynamics data sources, click fa-cogs Configure Data Source.
  3. Within the data source’s detail page, click Enable Metadata Cache fa-history.

With metadata caching enabled, Skuid will store the metadata for that particular data source—greatly improving load times on any pages that use it.

Note

It is important to note that Skuid will only cache the metadata that the Skuid admin has access to within the Dynamics system. If the admin that enables caching does not have access to any objects on the system-side, then that metadata will not be cached.

It is recommended that a user with full Dynamics permissions be the Skuid admin to enable caching.

Refresh the metadata cache

Skuid cannot detect that a data source’s metadata has changed—such as when a new object or field is created—and it will not automatically re-cache the metadata.

To ensure the cached metadata is up-to-date—or if you know the data source’s metadata has changed recently—you’ll need to refresh the cache:

  1. Navigate to Configure > Data Sources > Data Sources.
  2. Beside any cached Dynamics data sources, click Refresh Metadata fa-refresh.

Doing this will cause Skuid to re-download the metadata from that data source, grabbing the most recent updates in the process.

Note

As with enabling metadata caching, ensure that a fully permissioned user refreshes the cache in Skuid. If the Skuid admin does not have access to a previously cached metadata object, that object will be deleted when the cache is refreshed.

Disable metadata caching

To disable and delete Skuid’s metadata cache for a data source:

  1. Navigate to Configure > Data Sources > Data Sources.
  2. Beside the cached data sources, click Disable Metadata Cache fa-chain-broken.

This will clear Skuid’s cache of any stored metadata. You can re-enable caching at anytime by clicking Enable Metadata Cache fa-history.

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 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.
  • If you’re using an Apex proxy, the response from the service (Odata metadata for Microsoft Dynamics) is still subject to Salesforce heap size limits. If the response is too big to represent in a string. To resolve this:

    • In the App composer, navigate to Configure > Data Sources.
    • 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.

  • If you see the following URL when attempting to authenticate:

    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