Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Colour Grid Lines Based on Status

Posted on by 1,779

I know there was never a supported method of doing this with previous versions of CRM, but I thought I'd read somewhere there was a supported way in D365?

*This post is locked for comments

  • Suggested answer
    AbhiCode Profile Picture
    AbhiCode 492 on at
    RE: Colour Grid Lines Based on Status

    Hi MDS,

    For grid color on the base of status, we can achieve this using javascript. 

    https://dynamicspeople.wordpress.com/2017/03/22/best-way-to-call-common-javascript-from-application-ribbon/

    In this link Task1 check for calling the javascript

    And 

    JavaScript 

    function FormatGrid(Status,Colors) {
        var conditionArr = Status.split("|");
        var colorArr = Colors[1].split(",");
    
        var hdText = conditionArr[0].toString();
    
        var tblHeaders = window.top.document.getElementById('contentIFrame0').contentWindow.document.getElementById('gridBodyTable').getElementsByTagName('TH');
    
        var hdIndex = 0; var i = 0;
        var chkKeyWord = "";
    
        //Loop through the headers to find the index of hdText
        for (i = 0; i < tblHeaders.length; i++) {
            if (hdText == tblHeaders[i].innerText) {
                hdIndex = i;
                break;
            }
        } //end of for
    
        var rows = window.top.document.getElementById('contentIFrame0').contentWindow.document.getElementById('gridBodyTable').rows;
        var ctr = 0;
    
        for (i = 1; i < rows.length; i++) {
            for (var j = 0; j < colorArr.length; j++) {
                if ((rows[i].cells[hdIndex].innerText).substring(rows[i].cells[hdIndex].innerText.length - 1, rows[i].cells[hdIndex].innerText.length) == "\n")
                    chkKeyWord = (rows[i].cells[hdIndex].innerText).substring(0, rows[i].cells[hdIndex].innerText.length - 1);
                else
                    chkKeyWord = rows[i].cells[hdIndex].innerText;
    
                if (chkKeyWord == (colorArr[j].split("="))[0].toString()) {
                    rows[i].style.color = (colorArr[j].split("="))[1].toString();
    
                    //To color valid cells
                    for (ctr = 0; ctr < rows[i].cells.length; ctr++) {
                        if (rows[i].cells[ctr].className != "ms-crm-List-NonDataCell"
                            && rows[i].cells[ctr].className == "ms-crm-List-DataCell inner-grid-cellPadding"
                            && rows[i].cells[ctr].innerText != ""
                            && rows[i].cells[ctr].children[0].children.length > 0)
                            rows[i].cells[ctr].children[0].children[0].style.color = (colorArr[j].split("="))[1].toString();
                    }
    
                    break;
                }
    
                chkKeyWord = "";
            }
        }


  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Colour Grid Lines Based on Status

    The link I have shared works.

  • Suggested answer
    ram r Profile Picture
    ram r on at
    RE: Colour Grid Lines Based on Status

    There is no supported way to achieve this. But you can use DOM manipulation and the better way is to create your own web resource with a table.

  • MDS Profile Picture
    MDS 1,779 on at
    RE: Colour Grid Lines Based on Status

    Thanks all.

    This sounds exactly what I'm looking for, but the link is dead.

  • Suggested answer
    M.Azwar Alam Profile Picture
    M.Azwar Alam on at
    RE: Colour Grid Lines Based on Status

    You can check following link as well

    community.dynamics.com/.../adding-icons-and-tooltips-to-grid-column-in-dynamics-365

    Mark answer as verified, if it works for you

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Colour Grid Lines Based on Status

    I think you can color a column. Check this (use images for colors)

    community.dynamics.com/.../adding-icons-and-tooltips-to-grid-column-in-dynamics-365

  • Suggested answer
    M.Azwar Alam Profile Picture
    M.Azwar Alam on at
    RE: Colour Grid Lines Based on Status

    You can check below link

    dynamicsofdynamicscrm.com/.../adding-row-colours-to-crm-2013-sub-grids-dynamically-based-on-value-in-cells

    community.dynamics.com/.../188904

    Mark answer as verified, if it works for you

  • Suggested answer
    Gopalan Bhuvanesh Profile Picture
    Gopalan Bhuvanesh 11,397 on at
    RE: Colour Grid Lines Based on Status

    Hi

    There is no supported way to achieve this, yet.

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,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans