Skip to main content

Notifications

Microsoft Dynamics CRM (Archived)

Word document from plugin

Posted on by 80

Hi Experts,

Can we create word document from plugin for MSD 365? is it possible? If so how? Done anyone have sample code? 

Thanks. 

*This post is locked for comments

  • Abby Kong Profile Picture
    Abby Kong 6 on at
    RE: Word document from plugin

    No worries Vijay. Hope you find a way to solve the problem.

  • CRM-guy Profile Picture
    CRM-guy 80 on at
    RE: Word document from plugin

    Hi Abby,

    Thanks for kind help, probably i will go with some work around for this. Thanks again.

  • Abby Kong Profile Picture
    Abby Kong 6 on at
    RE: Word document from plugin

    Hi Vijay,

    I understand your pain in implementing custom logic with the restrictions of word document template.

    Again, I think a custom Fetch-based SSRS report would suit you better in this case as it's much more flexible and you can also generate word document from it.

    Maybe someone else can shed more light on this.

    Regards,

    Abby

  • CRM-guy Profile Picture
    CRM-guy 80 on at
    RE: Word document from plugin

    Hi Abby,

    I know we cannot apply filter on it, that's why i am trying to do it from plugin with my own query.

    Thanks.

  • Abby Kong Profile Picture
    Abby Kong 6 on at
    RE: Word document from plugin

    I think there are ways to read the word document from note and programmatically change the content and save it. I'm not an expert on this and I highly suggest NOT to do it. It's more work and maintenance going forward, in my opinion.

  • Abby Kong Profile Picture
    Abby Kong 6 on at
    RE: Word document from plugin

    Hi Vijay,

    As far as I know, we can't apply filter/sorting on the data source use word document template. 

    Not sure on the exact requirement, or the number of possible document outputs. If your template is different based on some condition, maybe you can create multiple templates and implement the logic to decide which one to run in the code.

    Alternatively, if you are triggering doc-creating in code, consider the option to create a custom Fetch-based report.

    This is a good guide: community.dynamics.com/.../ssrs-reports-for-dynamics-365-using-fetchxml
    It will be more coding than using word template, but you don't have the above-mentioned restriction on datasource.

    Regards,

    Abby

  • CRM-guy Profile Picture
    CRM-guy 80 on at
    RE: Word document from plugin

    Hi Abby,

    Thanks for quick responses. See, i am able to create and attach it in notes area of the entity but problem is now i want to add my custom data table in the same Document, is it possible?

    In word template i kept all the required details of the quote, its fine but now i want to fire a query in plugin and I will create a my data table and want to put that in the newly created document. I hope you got my query now. Let me now if you need any other info.

    Thanks.  

  • Abby Kong Profile Picture
    Abby Kong 6 on at
    RE: Word document from plugin

    docs.microsoft.com/.../manage-word-templates

    Refer above on creating word templates.

  • Abby Kong Profile Picture
    Abby Kong 6 on at
    RE: Word document from plugin

    hmmm, can you elaborate on 'change/append the content of the document'??

    The word template should be set up as a system template before you use this code.

    Use the template id from this system template.

    Replace 'new EntityReference("account", accountGuid)' if your entity is not account.

    The generated word document is same as the ones generated from UI ->Ribbon Buttons-> Word Template

  • CRM-guy Profile Picture
    CRM-guy 80 on at
    RE: Word document from plugin

    Thanks Abby, but will it allow me to change/append the content of the document? Or do i need to replace by some kind of trick?

    Thanks.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans