Notifications
Announcements
No record found.
Hello. How can I change the color of value(text) in column for each row in subgrid(CurrentView) by script ?
Thank you.
*This post is locked for comments
Hi,
You have add a web resource in a view. See below image
function OfferStatus(rowData, userLCID) {debugger;
if (rowData == null || rowData == 'undefined') return;
// read rowdata var str = JSON.parse(rowData);
var coldata = str.fieldschemaname(f1);
// F2 field is two options having yes and no values based on that we have to change the color of the grid rowvar submitted=str.fieldschemaname(f2); //get row/record guid var rowId = str.RowId;
if (coldata == null || coldata == 'undefined' || coldata.length < 1)
return;
if(submitted=="Yes"){ $('span:contains("Yes")').closest('tr').css('background-color', 'Coral')
}
else if (submitted=="" ||submitted=="No" ){ $('span:contains("No")').closest('tr').css('background-color', 'White')$('span:contains("")').closest('tr').css('background-color', 'White')
}}
Thanks Ridhima
@Ridhima- Modifying the dom isn't supported and should be avoided.
@Marina-
The better way would be to add different color icons in front of your cell.
Please refer -https://docs.microsoft.com/en-us/dynamics365/customer-engagement/customize/display-custom-icons-instead
-Shaminder
Hello Ridhima. Thank you for answer.
When this function works ? Where you write the call of OfferStatus() function ?
I need it works every time when open this subgrid.
Hi Marina ,
There is no supported way to change the text color , only you can add icon to above Shaminder suggested URL .
You can also see below post ,unsupported way change row color -
passion4dynamics.com/.../color-subgrid-in-microsoft-dynamics-crm-365
Hello Shaminder.
Thank you for answer.
Hi Goutam, thank you for answer.
As you clearly understand me, i don't need any icon, I need colored exactly the text in cell, not background, but text, because it is url, but shows in black color.
However, if there is no way, but you have such task, how you resolve it ?
I know this is not the supported way but one time client needed to change the row color according to other field value in subgrid
We have used this code and I have added image. you have to call this function where you have edit view column in views. View that used in subgrid. There can you give funtion name
Thanks
I understand your requirement but seems this is by design and there is no way to change the text color .You should not do the changes with unsupported way . I believe you know the meaning of unsupported , the customization you did , may not work when you upgrade to upper version. For this requirement I would suggest to convince your customer accordingly.
There is another option by retrieving the subgrid data and bind the data in a custom HTML webresource using third party grid (JQuery ,easyUI etc ). Apply your color in the custom grid.
We looked at doing some of this type of modification, but actually ended purchasing a third party add-on called CRM Grid Plus. Allows it to be modified easily in a GUI, no code, and has lots of options around indenting, colouration, column size and label modification, etc... And quite affordable, at least for our size of org.
No affiliation with the company - just think it's a solid option. :-)
Hi Allison, thank you for your answer.
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.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
SA-08121319-0 4
Calum MacFarlane 4
Alex Fun Wei Jie 2