Tech N Toast®

Customize entity views using JavaScript in Dynamics 365

Customize entity views using JavaScript in Dynamics 365

We have a large customer service team where all executives deal with different types of issues. For example, silver, gold, and platinum support services. We want to show red icon for high, amber icon for normal, green icon for low priority cases because this stuff brings more clarity and visibility to our data.

Microsoft says, "We recommend an icon size of 16x16 pixels (larger images will be scaled down)."

We used three PNG images larger than 16X16 pixels, which were automatically scaled down.


Tooltip - High Priority Case


Tooltip - Normal Priority Case


Tooltip - Low Priority Case

Let's talk about the script that we used to add the PNG images to our CRM data.

JavaScript code -

function displayIconTooltip(rowData, userLCID) {    
var str = JSON.parse(rowData);
var coldata = parseInt (str.prioritycode_Value);  
var imgName = "";  
var tooltip = "";
switch (parseInt(coldata)) {   

case 1:
       imgName = "new_red";  
       tooltip = "High Priority Case";  
       break;  
case 2:
       imgName = "new_amber";  
       tooltip = "Normal Priority Case";  
       break;  
case 3:   
       imgName = "new_green";  
       tooltip = "Low Priority Case";  
       break;  

   }  
   var resultarray = [imgName, tooltip];  
   return resultarray;  
 }    


Upload all the images, and then add the script. Please watch all the steps here -



This feature can be used for other entities as well. For example,  Opportunity, Lead etc. For more information, please read here - https://docs.microsoft.com/en-us/dynamics365/customerengagement/on-premises/customize/display-custom-icons-instead 


How to Customize entity views in Dynamics 365 -

Go to Customizations > Customize the System > Web Resources > Upload all the images and paste the script > Expand Entities > Choose > expand it > Click Views > A view > For example, My Active Cases > Edit > A Column > For example, Priority > Change Properties > A web resource > Function Name > A width for this column > OK > Save and close > Publish All Customizations

How to Customize entity views in Dynamics 365




No comments:
Post a Comment