Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Wanting to include specific contacts on a Word template from an entity where multiple contacts exist.

Posted on by Microsoft Employee

Hi, we're using Microsoft Dynamics 365 v.1612 on premises and have stumbled upon a little problem.

We have an accounts entity that can have multiple contacts attached to it, which show as a table on the form, created from a quick view on the contacts entity. 
On the account entity, we have set up a Word template to export data from the form to a report, but we don't seem to be able to choose which of the contacts it exports. It always chooses the first contact in the list.

Also, if the first contact doesn't have data in all of it's fields, the export will look to the next contact in the list and take any missing data from that, ending up with a Word document holding mixed contact details!

We have set a field in the contacts entity that is used to show which is the main contact for the account, and would like only that contact to appear on the resulting Word document, but still need all contacts to appear on the accounts form.

Is there any way we can do this? Maybe using Javascript or similar?

I have used Xrm.Page.ui.quickForms.get(quickviewname) to get data from quick view forms on pages, but that code doesn't seem able to access the quick view tables.

Below is a screenshot of our accounts page with the contacts table in the bottom right corner.

[View:https://imgur.com/iJ5KIj2:320:50]

*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Wanting to include specific contacts on a Word template from an entity where multiple contacts exist.

    Thank you so much, that worked perfectly.

  • Verified answer
    Alex Fun Wei Jie Profile Picture
    Alex Fun Wei Jie 33,626 on at
    RE: Wanting to include specific contacts on a Word template from an entity where multiple contacts exist.

    Hi,

    select the correct relationship when create the template.

    7506.37.png

    7506.37.png

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Wanting to include specific contacts on a Word template from an entity where multiple contacts exist.

    Thanks, That works for getting the contact's name to appear on the exported document, but we also need the email address, job title, mobile and landline numbers for the main contact too.

    Do you know of a way I can use the primary contact field to grab those details from the contacts data too? Would I need to have maybe a section with a quick view form from contacts linked on Primary contact?

    Thank you for your suggestion so far, I hadn't even noticed that field was there. I've recently taken over looking after the CRM from an external company so am learning how it works mainly by trial and error.

  • Verified answer
    Alex Fun Wei Jie Profile Picture
    Alex Fun Wei Jie 33,626 on at
    RE: Wanting to include specific contacts on a Word template from an entity where multiple contacts exist.

    Hi,

    use primary contact field in account form to indicate the main contact

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!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans