The following best practices can help you customize and extend Dynamics 365 Customer Engagement (on-premises).
Best practices for Dynamics 365 Customer Engagement (on-premises)
The Microsoft Dynamics 365 Customer Engagement (on-premises) patterns & principles for solution builders white paper download provides guidance specifically about building solutions using Dynamics 365 for Customer Engagement.
Using custom entities and attributes
Always use the entity name to refer to entities in code and queries. Do not use the object type code (also referred to as entity type) code because the integer value varies for custom entities in different organizations.
Save space on your server by using these techniques:
Create custom attributes for existing entities instead of creating a new entity.
Rename existing entities to make the entities more meaningful.
When should you customize an entity?
Customize a system entity, such as the opportunity entity, instead of replacing it with a new custom entity so that you can use the any built-in features in an existing entity.
When to use plug-ins vs. workflow?
As a developer who is interested in extending or customizing Dynamics 365 Customer Engagement (on-premises), you can choose from several methods to perform your tasks. In addition to adding client-side JavaScript code to a form or adding custom ASP.NET pages, you can write a plug-in or create a custom workflow by using the web interface that calls a custom workflow activity. How do you decide when to use a plug-in and when to use a workflow? The technology that you use depends on the task that you have to perform and who will author the customization.
For example, you must use a synchronous plug-in real-time workflow if you want to execute custom code immediately before or after the core platform operation executes and before the result of the operation is returned from the platform. You cannot use an asynchronous workflow or asynchronous plug-in in this situation because they are queued to execute after the core operation finishes executing. Therefore, you cannot predict when they will run. If you want to add custom functionality to Dynamics 365 for Customer Engagement, workflows, custom workflow activities, and plug-ins are supported, but custom XAML workflows are not.
Evaluate these technologies and select the one that best suits your business objectives after you consider the deployment, performance, and maintenance concerns of your plug-in or workflow solution.
What type of workflow is better?
From a performance perspective, is it better to create a single long workflow or is it better to have multiple child workflows and call them in one parent workflow? The child workflow approach achieves lower throughput, but it is more manageable if you frequently change your workflow definition. Compilation overhead is not a major concern because the workflow is compiled only during publishing. However, Dynamics 365 Customer Engagement (on-premises) incurs overhead when it starts each workflow instance. The overhead occurs when all entities that are used in the workflow are retrieved and the child workflow is started in a two-step process that includes a 'Workflow Expansion Task' and the actual workflow instance. Therefore, for maximum throughput, use a single long workflow.
How should you mark your custom workflow activity as completed?
The return value from the Execute method is used by the workflow runtime to mark the activity as “completed.” You should use return base.Execute(executionContext) unless the activity bypasses base class functionality. Avoid returning ActivityExecutionStatus.Closed. More information: ActivityExecutionStatus Enumeration
How should you report exceptions in custom workflow activities?
You should throw an InvalidPluginExecutionException in your code. This error will be shown in the workflow instance form.
Can you define custom entities that are specific to business units?
Custom entities have privileges for each security role but not for each business unit. To define custom entities that are visible only to specified business units, you must create different security roles for each business unit and grant privileges to the custom entity in the appropriate role.
I hope this helps!
Ruskin | Check out the blog Microsoft Power BI vs Tableau