Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Setting sort of related entities on Word template

(0) ShareShare
ReportReport
Posted on by 20

hi,

I've searched on internet a few days trying to discover how to configure an related entity on word template. I need to define a sort for opportunity products, because my template show the whole list sorted based on lineitemnumber, but for some reason the fetch isn't following the sequencenumber and bringing the products in a random order.
The data of a word template make use of any view where we can customize the order? Anyone needed something similar?

*This post is locked for comments

  • Sistech Profile Picture
    Sistech 106 on at
    RE: Setting sort of related entities on Word template

    Have there been any updates to this issue? I have the same requirements for a custom entity where the template list needs to be in the same order as in Dynamics.

  • Suggested answer
    Boyd-TCS Profile Picture
    Boyd-TCS on at
    RE: Setting sort of related entities on Word template

    I created a macro snip that sorts data on the applicable table. However, it will only work for the user that uploads it. For some reason, the macro doesn't show up for any other users in the CRM.

    Name the Macro "AutoOpen" for it to run automatically once the document has completed it's load process:

    Sub AutoOpen()
        If Application.Documents.Count >= 1 Then
            If ActiveDocument.Tables(6).Rows.Count > 2 Then
                ActiveDocument.Tables(6).Sort FieldNumber:=1, SortFieldType:=WdSortFieldType.wdSortFieldDate, ExcludeHeader:=True, SortOrder:=WdSortOrder.wdSortOrderDescending
            End If
        End If
    End Sub
    


  • ScottDurow Profile Picture
    ScottDurow 19 on at
    RE: Setting sort of related entities on Word template

    Hi Fernando,

    At this time unfortunately the list is shown in the order that the records were created (as per www.microsoft.com/.../using-word-templates-in-crm.aspx)

    AFIK there is no way around this at this time other than recreating special records for your template in the order that they are needed to be displayed.

    Not the answer you were looking for - but I'm looking forwards to improvements in this area in future versions.

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

Announcing Our 2025 Season 1 Super Users!

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

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 231,305 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans