› Dynamics 365, Enterprise › CRM Tip: Automatically Creating document from Word Template and attaching to Record

CRM Tip: Automatically Creating document from Word Template and attaching to Record

 Somesh Siripuram   Leave a comment

Background:

In Dynamics CRM, one of the common requirement customer have is to Run a report and save the copy of the report (PDF/ Word/ Excel) as notes/ attachment on the record or send the created document as email attachment to customer.

Sounds an innocent requirement, right? With CRM online, it is NOT.

What we do to achieve this till now

We do one of the following when the customer asks this request:

  • Ask user to manually run report, download PDF and create email record or attach to record notes.
  • Use some paid 3rd party tool.
  • Tell the customer it is not possible For CRM Online. 😀
  • For On-prem CRM, developers would tweak the Report Viewer and somehow manage to achieve this with lot of effort and custom plugins.

Alternative:

With Dynamics 365, you have one alternative which does not exactly give you the above solution but is very close or may be acceptable adjustment to client.

We all know CRM 2016 also introduced word templates. But with D365, CRM has inbuilt Action to Run a word template and attach that to document without user action.

Since it is an action, it can be used in Workflows, Plugins, other actions and even in JavaScript using Web API.

Example:

I have created a workflow on Account Credit limit update, such that when credit limit is more than 10,000 an Account summary will be created using the Account Summary template and attached to the record.

See screenshots below of the workflow and generated document. All this without user intervention.

Pic 1 -Select Perform Action and Select Action – “Set Word template”
Pic 2 – Select the Target account record and the Word template in Action Properties
Pic 3 – Created document from the workflow- attached to the record.

Limitations:

  • We cannot create PDF documents using this approach
  • This is limited to Word templates and they are not yet as powerful as SSRS reports

Next Steps:

  • We can extend this functionality by may be having plugin on notes creation to send an email to customer or any other thing?

Please post your comments/ suggestions below.

Happy CRM’ing


Liked it? Share it.

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload the CAPTCHA.