D365 – Understanding Plug-in Pipeline

What is a Plugin?

  • Plug-in is a class library or set of classes. And when you compile a set of classes you get something called DLL file or Assembly file. This assembly file has some custom code and we register these assemblies in some server side event.
  • You can run plug-in code on common events such as Create, Update, Delete, Assign, etc . Of specific record type. In dynamics terminology event and message are same thing.
  • For example: On entering revenue field of a Contact, you would like to perform some tax related calculation automatically. So here the event is “On Update” and the entity “Contact”. This means the trigger is on update of a Contact record, where we can register the event.

What happens on server?

Scenario:

  • Let us say the client creates a contact record.
  • The information goes to the Main Event (say Create event) on the server. This even creates a record and pushes the data into the database.
  • A response will be sent back from the database through the main event back to the Client where the page will be reloaded / refreshed. Now you will see the contact record as saved contact.
  • Now again the Client updates the Revenue details on that contact.
  • The information goes to the Main Event (which is now Update event).
  • The platform takes care of the data and response comes back to the Client where the page is reloaded / refreshed.

So every time a client changes something, there is a round trip happening. In this case there is no custom code involved. Also, you cannot modify the main event and is handled by the platform.

The system, however, gives to the ability to write custom code before the Main Event and after the Main Event.

Let us say you want to run a custom code before the Contact record is created. You can write your custom code as class library, upload it to the server and register before the Main Event (i.e. Contact Create).

Similarly if you want to run your custom code after the creation of the Contact record, you can register after the Main Event.

Remember, the main event does not change. But you can have Pre validation stage and Pre Operation stage before the main event and Post operation stage after the main event.

So if you want to make changes to the data before it is inserted or updated in the database, you can use the Pre-Validation and Pre-Operation stage. If you want to perform changes to the data after the record is inserted or updated in the database and before it reaches to the Client, you can use the Post-Operation stage.

This is called as plugin pipeline.

Posted in Business Central, D365 Customer Engagement (CRM), D365 Development, Microsoft Dynamics 365 | Tagged , , , , , , , , , , | Comments Off on D365 – Understanding Plug-in Pipeline

D365 – Web Services

Dynamics 365 offers two web services:
  1. Discovery Web Service
    Retrieve List of Instances or Organization for given Credentials
  2. Organization Web Service
    Connect to each Instance or Organization and perform all basic CRUD and advanced message operations

Each of this service is available in two formats:

  1. SOAP
    For server side coding
  2. REST (Web-API)
    For client side coding

To find the endpoint for Web Services in D365, click Settings > Customizations > Developer Resources.

Posted in D365 Customer Engagement (CRM), D365 Development, Microsoft Dynamics 365 | Tagged , , , , , , , , , , | 1 Comment

D365 – Architecture Overview

Following is an overview of D265 CRM architecture.

Understanding the architecture is important to understand the entire ecosystem of development tools here.

  • So the first dotted line separates the client side components from the server side components.
  • Wherever you see the gear icon, those components are customizable. So you can write some custom code where you see the gear icons and these components are available on client side as well as on the server side.
  • Every D365 CRM instance has Metadata database and Data database. We don’t need to do much with it as the platform takes care of these databases.
  • Also, you cannot directly access or make changes to the database with any code.

What Custom Code can you Write?

You can broadly categorize the custom components into following types:

  • Server Side
  • Client Side

How does Custom Code access CRM data?

Custom code cannot access data directly from D365 CRM database.

It can access data though API (Webservices) only. The connection between webservices and database is taken care by the platform.

Posted in D365 Customer Engagement (CRM), D365 Development, Microsoft Dynamics 365 | Tagged , , , , , , , , , , | Comments Off on D365 – Architecture Overview

D365 – How To Create A Publisher And Solution?

To be able to start customizing the system in Dynamics 365, you must first create a Publisher and then a Solution.

Publisher is a Company Profile, whereas Solution is the work area, which you can later package and import in different environment. A publisher is responsible for creating and maintaining a solution.

You can create a solution in classic environment, i.e. Settings > Solutions.

OR you can use the new environment which is discussed below:

  • Click New Solution, in the quick create window, specify:
    • Display Name
    • Click “+Publisher” to create a new Publisher

  • Provide the Publisher details, i.e. the Company Profile. Specify the following fields:
    • Display Name
    • Name (generated automatically, but you can change it)
    • Description
    • Prefix (to easily identify the changes made by the publisher. The default is “new”,, which you can change).
    • Option Value Prefix (the number series for the prefix.
  • Additionally you can specify contact details of the publisher.

  • Now, specify the Publisher for the solution and click Create.

  • Now in the solution list you can see the solution you created.

  • Open the solution to start adding existing entities or create new ones.

Posted in D365 Customer Engagement (CRM), D365 Development, Microsoft Dynamics 365 | Tagged , , , , , , , , , , | Comments Off on D365 – How To Create A Publisher And Solution?

How to assign records using workflows in Dynamics 365?

Scenario:

A company has a large customer base and dedicated support system.

Presently, any support engineer can pick up a case and resolve it. But the challenge is with High Priority Cases. High Priority Cases are taking more time to resolve because currently they are not assigned to highly specialized team.

This is resulting in poor customer experience and directly impacting revenue.

Proposed Solution:

The company has decided to create a dedicated team to handle high priority cases for quick resolution and ultimately increase customer satisfaction.

So, whenever a new case is created with High Priority or case priority changes to High, it must be assigned to High Priority Team.

Perform the following steps:

  • Go to Settings > Security > Teams
  • Create a Team say “High Priority Cases” team and add users to it. Members in this team will handle all high priority cases. (Optional)

    Note: Setup the appropriate

  • Go to Settings > Processes.
  • Click New.

  • Specify the following fields and click Ok.
    • Process Name: Assign High Priority Cases to High Priority Team
    • Category: Workflow
    • Entity: Case
    • Run this workflow in the background (recommended): Yes
    • Type: New Blank Process

  • Check the Workflow header settings and change the Scope to “Organization”. Note: If you define the scope as “User” then you need to set the Owner under Administration tab.
  • We would like to run this workflow when Record Field Change, so select that option. Select the fields and click Ok.

    Note: Also select “Record is created”.

  • Now define the following conditions and set properties:

  • Activate the Process.

  • Create a Case with Normal Priority and check the Owner.

  • Change the Priority to High and then check the Owner.

  • In case there is any error or you want to check the process. Open the workflow, click Process Sessions.

Posted in D365 Customer Engagement (CRM), D365 Tips & Tricks, Microsoft Dynamics 365 | Tagged , , , , | Comments Off on How to assign records using workflows in Dynamics 365?

How to update records using workflows in Dynamics 365?

Scenario:

As per the company’s policy, every customer and their contacts must get their KYC (Know Your Customer) done every six months.

It is easy to update Account’s Address, but it takes a lot of time when users need to update Account’s Primary Contact Addresses as well (which is same as Account’s Address).

There are 100K+ customers and on an average, it takes about a minute to update address of one contact. This also reduces the efficiency of the users.

Solution:

On updating an Account’s Address, their Primary Contact’s Address must be updated automatically without performing any manual process.

This would save a lot of time and users can focus on productive work.

Perform the following steps:

  • Go to Settings > Processes.
  • Click New.

  • Specify the following fields and click Ok.
    • Process Name: Update Contact’s Address When Account’s Address is Updated
    • Category: Workflow
    • Entity: Account
    • Run this workflow in the background (recommended): Yes
    • Type: New Blank Process

  • Check the Workflow header settings and change the Scope to “Organization”. Note: If you define the scope as “User” then you need to set the Owner under Administration tab.
  • We would like to run this workflow when Record Field Change, so select that option.

  • Select the fields and click Ok.

  • Now define the following conditions and set properties:

  • Activate the Process.

  • Now open an Account which has Primary Contact and change the address on the Account. For example we changed details in “Street 2”.

  • Since it’s a background process so there will be slight delay. After which you can see that the desired tasks are created automatically based on the trigger.
  • Open the Primary Contact and check if the record there is updated based on our settings.

Posted in D365 Customer Engagement (CRM), D365 Tips & Tricks, Microsoft Dynamics 365 | Tagged , , , , , | Comments Off on How to update records using workflows in Dynamics 365?

How to create records using workflows in Dynamics 365?

Scenario:

In a large organization, it’s getting difficult to manage leads follow-ups because of the high volume.

The organization is using D365.

Most of the salespeople forget to follow-up with leads on time and hence the leads-to-customer conversion is going down every single day.

Ultimately, the organization is losing business every day.

Suggested Solution:

Whenever a new lead is created, D365 should automatically create two follow-up reminders and assign to the responsible salesperson.

Perform the following steps:

  • Go to Settings > Processes.
  • Click New.

  • Specify the following fields and click Ok.
    • Process Name: Create 2 Follow-up Tasks on Lead Creation
    • Category: Workflow
    • Entity: Lead
    • Run this workflow in the background (recommended): Yes
    • Type: New Blank Process

  • Check the Workflow header settings and change the Scope to “Organization”. Note: If you define the scope as “User” then you need to set the Owner under Administration tab.

  • Now define the following conditions and set properties:

  • Activate the Process.

  • Go ahead and create a new Lead.

  • Since it’s a background process so there will be slight delay. After which you can see that the desired tasks are created automatically based on the trigger.

  • Open the task to see more details.

Posted in D365 Customer Engagement (CRM), D365 Tips & Tricks, Microsoft Dynamics 365 | Tagged , , , , | Comments Off on How to create records using workflows in Dynamics 365?

What are the types of workflows in Dynamics 365?

Background Workflow (Asynchronous)

Note: It is now recommended to use Microsoft Flow instead of background workflow.

In the screenshot above you can see the background workflow. Let us discuss each option in detail:

  • Process Name
    • It is the name of the workflow.
    • Try giving a meaningful name, so that you can identify and make changes later. For example, a name that suggests why you created the workflow and what it does.
  • Activate As
    • You have an option to activate this workflow as a Process (which can work independently) or Process Template (to reuse).
  • Available to Run
    • Run this workflow in the background (default).
      In case of background process, this option is always selected and cannot be edited.
    • As an on-demand process.
      With this option selected, the workflow will be available for users to run it on demand, i.e. users can trigger the process.
    • As a child process.
      With this option selected, this workflow can also be called by other workflows.
  • Workflow Job Retention
    • Automatically delete completed workflow job.
      You can select this option to save disk space. Whenever you run a workflow, it runs a job in the background. In case you have selected this option, the system then deletes that job once it is completed.
  • Entity
    • Specify for which entity this workflow will run.
  • Category
    • Workflow are part of processes in D365
  • Scope
    • Scope of the workflow (with ownership)
    • This defines till which level this workflow can be executed. This is dependent on Ownership, which you can defile under “Administration” tab.
    • User
      The workflow will run only on records that the user owns.
    • Business Unit
      The workflow will run only on all records that are available in a Business Unit.
    • Parent: Child Business Unit
      The workflow will run on all records that are available in the parent Business Unit and its child Business Units.
    • Organization
      The workflow will run for all the users available in the organization.
  • Start When
    • When the workflow must execute
      • Record is created
      • Record status changes
      • Record is assigned
      • Record field change
      • Record is created

Real-Time Workflow (Synchronous)

  • Available to Run
    • Run this workflow in the background (disabled)
    • As an on-demand
    • As a child process
  • Workflow Log Retention
    • Keep logs for workflow jobs that encounter errors.
      If a workflow job fails, you might want to keep the logs to examine later.
  • Options for Automatic Processes
    • Scope
      Same options as background workflow.
    • Start When
      • Record is Created (After only)
      • Record Status Changes (Before and After)
      • Record is Assigned (Before and After)
      • Record is Deleted (Before only)
    • Execute as
      • The owner of the workflow
      • The user who made changes to the record

Workflow Components

These are the operations that you can perform when you are executing a workflow:

  • Stage
    Allows you to organize workflow so it is easy to manage.
  • Check Condition
    Allows you to check conditions on field’s value (of entities) – If then Else.
  • Conditional Branch
    Works with the “Check Condition” as If-then and otherwise If-then.
  • Default Action
    Default action works always as Otherwise (without a condition).
  • Create Record
    Created a record of an entity.
  • Update Record
    Update a record of an entity.
  • Assign Record
    Assign a record to User or Team.
  • Send Email
    Send an e-mail.
  • Start Child Workflow
    Start a child workflow.
  • Perform Action
    Allows you to invoke actions. These are types of process without writing a code.
  • Change Status
    Allows you to changes status of the entity record.
  • Stop Workflow
    Stops the workflow as either Cancelled or Succeeded.

Posted in D365 Customer Engagement (CRM), D365 Tips & Tricks, Microsoft Dynamics 365 | Tagged , , , , , | Comments Off on What are the types of workflows in Dynamics 365?

Custom Icons and ToolTip in D365 Views

You can add graphics to a view and establish the logic used to select graphic based on column value using JavaScript. In the following example we will customize “All Opportunities” view and display icons alongside “Rating” column.

Select Icons

Select the icons that you would like to use. In this example we have selected 32×32 PNG icons for Rating options: Hot, Warm and Cold.

Image Web Resources

  • Create 3 Web Resources for these images, for example: new_Hot, new_Warm and new_Cold.
  • Save and Publish.

Create JavaScript Web Resource

Next we create a JavaScript Web Resource, for example: “new_OpportunityStatus_JavaScript”.

In this example, we have a separate JavaScript Web Resource for each column that we want to show an icon on.

function displayIconTooltip(rowData, userLCID) {

var str = JSON.parse(rowData);

var col_data = str.opportunityratingcode_Value;

var imgName = “”;

var tooltip = “{” + col_data +”}”;

switch (col_data) {

case 1:

imgName = “new_Hot”;

tooltip = “Hot”;

break;

case 2:

imgName = “new_Warm”;

tooltip = “Warm”;

break;

case 3:

imgName = “new_Cold”;

tooltip = “Cold”;

break;

default:

imgName = “opportunityratingcode”;

tooltip = “Unknown”;

break;

}

var resultarray = [imgName, tooltip];

return resultarray;

}

Link JavaScript to a Column in View

In this example, we open the “All Opportunities” view and for “Rating” column click Change Properties.

In this example we provide the following information:

  • Web Resource: new_OpportunityStatus_JavaScript
  • Function: displayIconTooltip

Optionally Select a width for this column, say 150px and click OK. Save and Publish the changes.

Go to Sales Hub in Dynamics 365 and for Opportunities open “All Opportunities” view to see the change.

Posted in D365 Customer Engagement (CRM), D365 Tips & Tricks, Microsoft Dynamics 365 | Tagged , , , , , , , , | 1 Comment

How to Create Project Contract? (Episode 14)

This in continuation to Episode 11 and Episode 12, where we had discussed how to create a Quote and a Project, respectively. If you are reading this episode directly, I would recommend you to have a look at those episodes first.

Creating Project Contact (Statement of Work)

  • Open the quote, which we had created in Episode 11.
  • Go to Quote Lines tab and check the details.

  • Check if the Project is assigned to the Project-based lines. For example, in this case you can assign the same Project, created in Episode 12, to the Fixed Price line.

  • Check details under each tab and once you are satisfied, on the Quote, click Close as Won.

  • This will create and open the Project Contract, in Draft state. Note that the Project Contract is similar to Order in Sales, however, the form is different.
    • Check all the details, which have been copied from the Quote.
    • You can still make changes to the Draft Project Contract.
    • In case you did not provide the Invoicing Schedule (for contract lines) at Quote level, the do it now, because this is the last stage where you can define the invoicing schedule.

  • Once you are satisfied with the Project Contract, click Confirm. This will Activate the Project Contract and the Status Reason will be set to Confirmed.

Watch the video:

Posted in D365 Customer Engagement (CRM), D365 Project Service Automation (PSA), Microsoft Dynamics 365 | Tagged , , , , , , , , , , , , , , , , , | Comments Off on How to Create Project Contract? (Episode 14)