Use Plugin Tracing to identify Plugin time-out issues

In Dynamics plugin implementations, you might have lengthy complex plugins that makes calls to Dynamics several times. I agree that calls to Dynamics should be as less as possible and use Link Entity as much as possible and the plugin should be well designed to handle such lengthy executions.

However, there are instances where these plugins are probably updating some fields that in-turn trigger some other sync processes and the execution begins to take longer than it should.

At times, such lengthy executions result in the plugin timing out. In case of Dynamics 365 Online, the timeout is 2 minutes and you can’t change it. (In on-premise, you can)

actualError

And now, you need to know what’s taking so long! So I want to propose a method which proved effective for me to identify this.

First, in case you are looking to work with Tracing for plugins, here’s a great blog on the same – Debugging Your Plug-ins with the Plug-in Trace Log

Add DateTime to Trace Logs

One of the best approaches to identify what portion of the plugin execution is actually taking time to process is to keep adding Trace logs and that too, with a timestamp!
timestampInCode

This will give you an idea of what part of your plugin is taking long to execute and will give you a fair idea if anything needs to be redesigned.

Set these traces at the very beginning of your plugin and at all necessary places as well as the very end to cover execution cycle well.

And your logs will actually record the time when that operation was hit.

timingsRecorded.png

So now, you have an idea of how the 2 mins are spent and maybe start troubleshooting in that direction.

Hope this quick tip helps!

Create & Send PDFs from Word Templates for Quotes in D365 CE Wave 2 Updates

And as we continue to ride on the Wave 2 October release features of the D365 for Sales, here’s a much anticipated feature Salespeople have been asking for. The ability to send Quotes as PDF (derived from Word Templates) right from the Quote itself.

At the time of this blog, I had enabled the Wave 2 Updates on the trial instance. Kindly try the same in your Sandbox instance first.

If you’re looking to enable Wave 2 Features for your organization, check this post –  Early Opt-in for October 2019 Wave 2 Updates.It is recommended you try these features on the Sandbox first.

Enable PDF Generation

As a part of the Wave 2 feature, you’ll need to enable this in the App Settings in the Sales Hub (typically).

  1. Navigate to App Settings
    appSettings
  2. In App Settings, look for PDF Generation area as shown below, You’ll notice that the feature might be turned off.
    settingOff.png
  3. You’ll simply need to turn it on and then Apply the changes.
    settingOn
  4. That’s it. You’re all set to use it. You’ll now see the 2 new buttons to Create PDF or Email as PDF.
    newButtons

    When this feature isn’t enabled, you won’t see the buttons –
    noButtons

Generate PDFs only

  1. Now, as the name suggests, if you chose to only Create a PDF out of the Word Templates you already have in place, simply drop down the menu and select the template you wish to get the PDF of.
    createPDF
  2. And the browser will throw a file in your system like any other download.
    downloadedPDF.png

Send Directly in Emails from Quote entity

  1. Typically, once things look good, you want to just send out the PDF as an attachment in an email from Dynamics. This button will let you do just that –
    emailAsPDF
    As you observe, this also works with your personal Word Templates too.
  2. Once you click on the Template, an email is ready for you to start writing and send when ready with the template attached as PDF already.
    draftedEmail

There are also some smart emailing capabilities that let’s you send email right from the context of the record. Check this post of mine for the same: Contextual Email communication in D365 CE Wave 2

Hope this helps!