Code Free Dynamics 365 Configuration Values

Dynamics 365 Configuration Values

In many systems, there will be a need to store key/value pairs for configuration data. Examples of this might be contact email address for an email template or a link to a payment gateway etc. To further complicate things we have development, test and production environments. What will be a valid set of values in production will most likely not be appropriate in a test environment? Here’s how I’ve tackled to issue of storing and retrieving Dynamics 365 Configuration Values.

Create two Entities:

  • Configuration Environment
  • Configuration

and create a Global Action:

  • Action – Get Config Value

There also some other helper Workflows that are useful for testing the config name/value pairs are being retrieved correctly.

OK, so let’s take a look at the solution:

Configuration Environment:

Figure: Configuration Environment

The Configuration Environment entity is used to track environments used in the Dynamics 365 installation, typically there will be a Sandbox and Production Environment, but there can be as many environments configured as required.

Environment Name: (text) Friendly Name, eg: Production

Default Environment: (boolean) True if this is the default environment, only one environment can be the default, used by Action – Get Config Value if no environment parameter is passed in

Short Name: (text) The instance portion of the URL, eg:

URL: (text) The full URL to the environment eg: 


Figure: Configuration

The Configuration entity is to store the key/value pairs per environment. The values are stored in a text field so the developer will need to handle datatype casting.

Environment Short Name: (text) Shortcut to the Short Name field in Configuration Environment, populated on create and update of the Configuration Environment

Configuration Environment: (lookup) Lookup to Configuration Environment

Name: (text) Name

Configuration Value: (text) Value

Test Result: (text) Test Result is a scratch area used to test results are coming back as expected, this field is typically hidden in the Configuration Form

Action – Get Config Value

Figure: Action – Get Config Value

Action – Get Config Value does the work of retrieving the key/value pairs. It can be called by passing in the ConfigName and Environment parameters or just the ConfigName (Environment is optional). When only the ConfigName is passed the Default Environment from Configuration Environment is used.

This action can be called from a Workflow, another Action or custom code.

Testing it

There are two Workflows created for the Configuration entity:

  1. Configuration – Test Get Config
  2. Configuration – Test Get Config with Default Environment

Both are on-demand workflows that pass in the Config Name and Environment Short Name. Test Result is populated with the ReturnValue. These Workflows can be used to quickly test the Key/Value are being returned correctly from Action – Get Config Value.

Figure: Testing Action – Get Config Value

Figure: Test Result displaying a message with the ReturnValue (note Test Result is normally hidden, so use Dynamics CRM Power Pane to unhide it)


Action – Get Config Value uses the Query Values action from Demian Raschkovan’s Dynamics 365 Workflow Tools.

While not a dependency, Jason Lattimer’s CRM String Workflow Utilities is very useful to parse the Record URL (Dynamic) field in a workflow using the Regex Extract Action. The result of this action can then be checked against Configuration Environment and passed into Action – Get Config Value Environment variable. This way the key/value pairs will be retrieved correctly for each environment.


The unmanaged solution is available to download, but remember to install the Dynamics 365 Workflow Tools and optionally CRM String Workflow Utilities first.

Figure: Solution Components


Related Post

Leave a Reply

Your email address will not be published. Required fields are marked *