Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Change View Column Title with Javascript

Posted on by 1,779


I need to change a column title on a view. I know I can change the display name on the field, but that leaves the related entity displayed in the column title which is a problem for me.

Old column title: Investment (Parent Account)

New column title: Investment

I'm loading a web resource jscript as follows, but nothing is happening:

function changeColumnText() {
    $(document).ready(function () {
        $("label:contains('Investment (Parent Account)')").text('Investment');
    });
}

What am I missing?

*This post is locked for comments

  • ashlega Profile Picture
    ashlega 34,475 on at
    RE: Change View Column Title with Javascript

    Add data duplication - on the account entity, create a field called "Parent Account Investment" (or whatever other name you like), and use a workflow to set that field whenever "Investment" field is updated on the Parent Account (although, again you'll probably need a custom workflow activity/plugin to do that.. but, at least, it'll be done in a supported way). Then use it in the views.

  • MDS Profile Picture
    MDS 1,779 on at
    RE: Change View Column Title with Javascript

    Thanks Alex. That all looks a bit beyond my rudimentary dev skills!

    My goal is to produce a CSV from a view in CRM but the column title must not include the related entity information. Are there any other option available to me?

  • Suggested answer
    ashlega Profile Picture
    ashlega 34,475 on at
    RE: Change View Column Title with Javascript

    Looks like those instructions are somewhat incomplete. Adding a web resource to Dynamics does nothing until you load that web resource somehow. You can add it to a form, but, it seems you need this in the dashboards/main views.

    In which case you might try loading it as a web resource for a button:

    crmblocks.blogspot.ca/.../how-to-implement-enable-rule-on-ribbon.html

    Maybe create an additional custom rule for one of the default buttons:

    ribbonworkbench.uservoice.com/.../81981-2-customising-standard-ribbons

  • MDS Profile Picture
    MDS 1,779 on at
    RE: Change View Column Title with Javascript

    Alex - thanks.

    I am following the instructions in this post stackoverflow.com/.../dynamics-crm-365-queue-view-remove-object-label-in-column

  • ashlega Profile Picture
    ashlega 34,475 on at
    RE: Change View Column Title with Javascript

    So how are you loading the web resource?

    In either case, you need to call that function somehow. Might probably try removing the function and leaving just this code:

    $(document).ready(function () {

           $("label:contains('Investment (Parent Account)')").text('Investment');

       });

    Although, it depends on whether JQuery will be loaded.. back to the question of how are you loading the web resource.

  • MDS Profile Picture
    MDS 1,779 on at
    RE: Change View Column Title with Javascript

    No..... I didn't think that was an option on a View, just a entity form?

  • ashlega Profile Picture
    ashlega 34,475 on at
    RE: Change View Column Title with Javascript

    Hi,

     I am not sure - that's completely unsupported, of course - but I'm wondering if you have added changeColumnText to the onLoad?

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