Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

How to insert the currently logged in user into the word template.

(0) ShareShare
ReportReport
Posted on by 10

Hi,

Does anyone know or have any idea on how to retrieve the name of the currently logged in user and dynamically insert it into a word template in online crm 2016?  What I want to achieve is that when a user generates a word document from within online crm 2016 his/her name will be automatically inserted into the generated word document.

Thanks,

Dzung.

*This post is locked for comments

  • bpr_admin Profile Picture
    bpr_admin on at
    RE: How to insert the currently logged in user into the word template.

    Do you have the javascript for this? Even better I think would be to have the code run against the user in the user entity running the template. Thoughts?

  • Suggested answer
    Aric Levin Profile Picture
    Aric Levin 30,188 on at
    RE: How to insert the currently logged in user into the word template.

    Hi Dzung,

    Based on some investigating, it doesn't seem like your requirement is possible with Word Templates.

    Getting the logged in user is not one of the attributes that are being passed to the Word Documents.

    Your alternatives are as Francesco specified (which as you mentioned does not work for you), or alternatively a FetchXml report where you get the logged in user as part of the report.

    Hope this helps.

  • Dzung Profile Picture
    Dzung 10 on at
    RE: How to insert the currently logged in user into the word template.

    Hi Franceso,

    Thanks for your reply and solution.  This solution will not work if multiple people access the same record around the same time which is the situation I am in.

    Kind regards,

    Dzung.

  • Suggested answer
    RE: How to insert the currently logged in user into the word template.

    Hi Dzung,

    i writed a javascript customization that does this trick a long time ago.

    Proceed as follows:

    1) Create a new attribute, we say "Last user"

    2) Create an onload event which check if last user is empty or differente from current user

    3) If different, save throught webapi current user

    4) Into word template, use last user -> fullname

    Please, let me know if you solve.

    If you found the answer helpful, please mark as Verified 

    Join my network on LinkedIn      Follow me on Twitter 

    Thank You & Best Regards

    Francesco Picchi

    Microsoft Dynamics CRM Consultant, Bologna+Milano, ITALY

    Independent Contractor

    http://www.francescopicchi.com

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,407 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans