# Microsoft Dynamics

This plugin will periodically query the Microsoft dynamics API for new and updated matters. It will query the config defined matters endpoint with a filter based on the "modified on" date.

Create a ClientID and SecretKey. There are no additional permissions required. See https://docs.microsoft.com/en-us/powerapps/developer/common-data-service/authenticate-oauth#use-client-secrets--certificates (opens new window)

Specify the Tenant url without https:// (for example epona.onmicrosoft.com). This is used to login into the tenant using the url https://login.microsoftonline.com/{tenant} (opens new window).

The ClientID should be associated with an application user that is defined in Microsoft Dynamics. See https://docs.microsoft.com/en-us/powerapps/developer/common-data-service/authenticate-oauth#connect-as-an-app (opens new window)

Add the securityrole/permissions to the new user.

It's possible to define a filter on what matters are imported based on the MatterCode (for example "PRJ_*" to only import mattercode that start with PRJ_).

Use a LastRunDateTime date before 1-Jan-2000 to fetch all matters.

# Plugin Configuration

Copy the dll files from the Plugins\MSDynamics directory to the site provisioning directory.
Restart the service to activate the plugin.

Start the configurator and browse to CustomSettings to configure the MSDynamics plugin.

Specify the Url, RedirectUrl, ClientId, ClientSecret and Tenant. The root url for the dynamics API like https://xxxx.crm.dynamics.com.

If the specified user is linked with multiple organizations, also specify an Organization name.

You can set the following properties:

UrlMattersEndpoint
Specify the matters URL endpoint and its parameters required to get the information from the matter.
Example1: incidents?$select=*&$expand=customerid_account($select=accountid,name),owninguser($select=fullname),customerid_contact($select=fullname;$expand=parentcustomerid_account($select=name))
Example2: si_investmentaccounts

Optional configurations - Client Endpoint
If the api does not have all the client data in the matters' endpoint, you can set a specific endpoint for getting the clients' data

Optional: MattersEndpointClientIdProperty
Specify the client id property in the matter endpoint. Example: _si_household_value

Optional: UrlClientsEndpoint
Specify the clients URL endpoint and its parameters.
Also fill this property if you want to create a generic matter for every client.
Example: accounts?$filter=customertypecode eq 1 or customertypecode eq 8\

Optional: ClientsIdProperty
Specify the client id property in the client endpoint.
Example: accountid

# Mappings

TestMapping
If enabled, move the parsed json to the test directory and don't update the lastchangedatetime

The following optional properties can be set:

Client Code
Set the MSDynamics property to map to ClientCode.
If using UrlClientsEndpoint then set the property from client endpoint.
Example1: customerid_account.accountid|customerid_contact.parentcustomerid_account.accountid|customerid_contact.contactid
Example2: accountid

Client Name
Set the MSDynamics property to map to ClientName.
If using UrlClientsEndpoint then set the property from client endpoint.
Example1: customerid_account.name||customerid_contact.parentcustomerid_account.name|customerid_contact.fullname
Example2: name

DefaultClientCode
Set the default string value for the client code. Only used if no mapping was found for ClientCode.

DefaultClientName
Set the default string value for the client name. Only used if no mapping was found ClientMatter.

Client Field Mapping
Optional field that maps json file client properties to sharepoint fields with syntax: sharepointname1=name1;sharepointname2=name2.
Use the character "|" for "or" conditions if null
If using UrlClientsEndpoint then set the propeties from client endpoint. For example: TestCaseTypeCode=casetypecode

Matter Code
Set the MSDynamics property to map to MatterCode.
Example1: ticketnumber
Example2: si_investmentaccountid

Matter Name
Set the MSDynamics property to map to MatterName.
Example1: title
Example2: si_name

Matter Field Mapping
Optional field that maps json file matter properties to sharepoint fields with syntax: sharepointname1=name1;sharepointname2=name2.
Use the character "|" for "or" conditions if null
Example1: MatterOwningUserColumnName=owninguser.fullname;MatterCaseTypeCodeColumnName=casetypecode;StateColumn=statecode
Example2: MatterStage=statuscode

Optional Functionality: Client Generic Matter
For creating a client generic matter set the UrlClientsEndpoint configuration property

Client Generic Matter: CreateGenericMatterForClients
Set True to get the clients from the client endpoint and create a generic matter for each.

Client Generic Matter: GenericMatterClientCode
Set the MSDynamics client property for client code.
Example: accountid

Client Generic Matter: GenericMatterClientName
Set the MSDynamics client property for client name.
Example: name

Client Generic Matter: DefaultGenericMatterCode
Set the string value to be used as matter code.
Example: DefaultCode

**Client Generic Matter:DefaultGenericMatterName **
Set the string value to be used as matter name.
Example: DefaultName

Client Generic Matter: Generic Matter Client Field Mapping
Maps MSDynamics fields to sharepoint fields with syntax: sharepointname1=name1;sharepointname2=name2
Example: ClientId=accountid

Client Generic Matter: Generic Matter Field Mapping
Maps MSDynamics fields to sharepoint fields with syntax: sharepointname1=name1;sharepointname2=name2
Example: MatterType="DefaultType"

# Filter

MatterFilter
Specify one or more filters in the format <field>=<value>;
If a filter is specified only items that match the filter are exported. One or more fields can be used to specify a filter. By default the filter is executed as "AND". Start the filter with "OR " to specify an OR filter. It's not yet possible to group filters or use a combination of and/or. You can use the | (pipe character) to specify an OR filter within the same field.
Use ; to specify more filters. If none of the filters have a match on the matter, the matter is skipped. For negation it can be used the ! character before the value to test.

MatterCodePatternFilter
Optional. MatterCode RegEx Pattern to optionally filter imported matters

# Post Handler - Save data in MSDynamics

SaveDataInDynamics
Set to True to save data back to MSDynamics matter in the post handler

DynamicsSaveDataEndpoint
Set the MSDynamics property to store the data
Example: si_investmentaccounts

DynamicsSaveDataProperty
Set the MSDynamics property to store the data
Example: DMSforLegalUrl

SharepointMatterIdProperty
Set the SharePoint json property that maps to the MSDynamics ID for filtering the correct matter
Example: MSDynamicsMatterId

SharepointMatterProperty
Set the Sharepoint json property to get the data from, to save in MSDynamics.
Example: URL

Last Updated: 2/27/2025, 4:40:25 PM