Dynamics CRM
The Dynamics CRM Service Type is used to expose CRM entities in a Microsoft Dynamics CRM Organization as SmartObjects.
You can create an instance of this Service Type for your CRM server and additional instances to target additional CRM Servers or Organizations. The CRM Service Type works in conjunction with the CRM Functions Service Type. Note that the CRM Functions broker does not require an instance per CRM Organization, since it works dynamically across any CRM instance.
Service Authentication
You can only use the Static Authentication Mode with the CRM Service Type.
Service Keys (Service Instance Configuration Settings)
You may get the following error when trying to refresh your CRM Online service instance or execute any CRM online related SmartObject:
"An error occurred when processing the security tokens in the message: You are using Ws-Trust authentication which has been deprecated and no longer supported in your environment. Please use OAuth 2.0 authentication."
If you do, make sure you change the Use OAuth Protocol with Static Credentials Service Keys setting to true.
The reason this error is appearing is that Microsoft deprecated the WS-Trust authentication type (also known as Office365 authentication type). You can find more information in the article Deprecation of Office365 authentication type and OrganizationServiceProxy class for connecting to Dataverse.
Key | Can be modified | Data Type | Sample Value | Notes |
---|---|---|---|---|
CRMServerURL | Yes |
Text | https://portal.denallix.com/CRM | Provide the CRM Server's URL. If the Use OAuth Protocol with Static Credentials setting is true, you can leave this field empty. If empty, the CRM Server's URL is based on the Global Discovery URL and Organization Name. |
OrganizationName | Yes (required) |
Text | denallix | Provide the CRM Organization Name for the organization defined in CRM that will be associated with this Service Instance. See Organization Name in Microsoft Dynamics CRM 2011. |
Dynamics365 Discovery URL |
Yes |
Text | https://globaldisco.crm.dynamics.com | Provide the Dynamics365 Discovery URL for registering cloud CRM service instances. |
Use OAuth Protocol with Static Credentials |
Yes |
Text | true/false | If this setting is true, the static credentials are used to get an OAuth token for Dynamics 365 CRM which is used for executions. |
OAuth Protocol Connection Parameters |
Yes |
Text |
AppId=51f81489-12ee-4a9e-aaae-a2591f45987d;RedirectUri=app://58145B91-0C36-4500-8554-080854F2AC97 |
If the Use OAuth Protocol with Static Credentials setting is true, these connection parameters are used with the static credentials to retrieve the OAuth token. To setup the connection parameters, see Use connection strings in XRM tooling to connect to Microsoft Dataverse. The generic Microsoft AppId and Redirect URI is populated in a Development environment. When using this in your Production environment, create an AppId or ClientId that is specific to your tenant in the Azure Management portal to get the AppId and RedirectUri. |
Service Objects
The Dynamics CRM Service typically exposes multiple Service Objects for the entities discovered when a Service Instance is registered. The list of exposed entities and methods can be seen in the following embedded Excel spreadsheet: CRM_MethodMatrix.xlsx. The CRM Service Broker exposes certain Entities (as described in the Excel sheet) and within each resulting ServiceObject, only certain methods are exposed. Not all Entity fields are created all the time. As per Microsoft's recommended best practice, the CRM API SdkMessageFilter is used to determine which methods to expose.
Each field in an entity has the following properties:
- IsValidForCreate
- IsValidForUpdate
- IsValidForRead
When describing the methods and creating the resulting ServiceObjects, the service broker filters out all fields whose value is false for the above mentioned properties, to avoid runtime exceptions. The SdkMessageFilter is then used to determine which methods it should expose for each entity. This is why certain Entities have all the methods and other Entities have only some of the methods.
The screenshot below shows some typical entities that are exposed when registering an instance of the CRM service, though the entities available in your environment may be different.
SmartObjects
If a CRM environment is configured during installation, K2 automatically generates SmartObjects for these Service Objects. SmartObjects can be automatically created by selecting the Generate SmartObjects for this Service Instance check box when creating a new Service Instance. Designers can use the SmartObject design tools to build advanced SmartObjects that leverage the Service Objects in this service. It is recommended to use the SmartObject design tools to create SmartObjects rather than generating SmartObjects, since this allows better control over the naming, behavior and design of the SmartObject and its methods and properties.
Considerations
- To use the K2 CRM SmartObjects and workflow wizards with Office 365, CRM must be activated within Office 365.
- The default Service Instance of this service is used internally by the K2 environment. Do not modify or delete the existing service instance. You can create a new instance or use the methods from the existing instance