Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 46379

Colored Grid Script not working in CRM 2016 update anymore.

$
0
0

Hello,

I had a custom unsupported script in our CRM2013 which colorized some Sub grid entries.

Now in CRM 2016 it won't work anymore and i can't figure out how to get it to work again.

i gues it's cause i used document.getElementsByTag. Some suggestions would be nice

Here's the Code which is working in CRM 2013

Thanks

Kai

function alterGridRecordsFaVc() {
    var gridId  = "accountopportunitiesgrid";
    var gridTH = parent.document.getElementById(gridId);
    if (gridTH == null) {
        setTimeout(alterGridRecordsFaVc, 2000);
        return;
    }
    var headers = gridTH.getElementsByTagName("TH");
    var tdata = gridTH.getElementsByTagName("TD");
    for (var n = 0; n < headers.length; n++)  {
        if (headers[n].innerText == "Status") {
            for (var i = 0; i < tdata.length; i++)  {
                if (tdata[i].innerText == "Offen"){ 
                    //tdata[i].style.backgroundColor = "blue";
                    tdata[i].style.color = "blue";
                }
                if (tdata[i].innerText == "Verloren"){ 
                    //tdata[i].style.backgroundColor = "red";
                    tdata[i].style.color = "red";
                }
                if (tdata[i].innerText == "Gewonnen"){ 
                    //tdata[i].style.backgroundColor = "red";
                    tdata[i].style.color = "green";
                }
            }
        }
    }
    for (var n = 0; n < headers.length; n++)  {
        if (headers[n].innerText == "Sonderkonditionen vereinbart?") {
            for (var i = 0; i < tdata.length; i++)  {
                if (tdata[i].innerText == "Nein"){ 
                    //tdata[i].style.backgroundColor = "blue";
                    tdata[i].style.color = "black";
                }
                if (tdata[i].innerText == "Ja"){ 
                    //tdata[i].style.backgroundColor = "grey";
                    tdata[i].style.color = "red";
                }                
            }
        }
    }
}



Viewing all articles
Browse latest Browse all 46379

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>