Sunday, 2 April 2017

Dynamics 365 – Add Icons to Entity Views

Dynamics 365 – Add     Icons to Entity Views


1.   Introduction

Microsoft Dynamics 365 has a new feature added for customizing entity views, where-in we can add custom icons with tool-tip text to display in a column depending on the column value; we can also specify localized tool-tip text.
This can be done by using JavaScript web resource and icons as image web resource. Below are the steps to add icons and tool-tips to entity view.
Note :  Adding custom icons with tool-tip is supported only for read-only grids; this feature isn’t supported for editable grids.
 The JavaScript function used for adding icons to view expects two arguments, they are
  1. Entire row object
  2. Calling user’s locale Id ( i.e LCID). It is used to specifies tool-tip text for icon in multiple languages.
Here we are selecting a custom two option set field which indicates the type of case (i.e Support or Fault). If the case is fault then show  blue color icon and  if support then red.

2.    Steps to add icons and tool-tips to entity view

  1. Get the icons of size 16*16 and add them as image web resource in dynamics (select number of icons based on your condition) .
  2. Add the below JavaScript function as a web resource.
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    function DisplayCustomIcons(rowVal, userlcid) {
     var imageName = "";
     var tooltipValue = "";
     var resultarray = null;
     try {
     var row = JSON.parse(rowVal);
     var rdata = row.osm_casetype_Value;
     if (rdata == true) {
     imageName = "new_Fault";
     tooltipValue = "Fault";
     }
     else {
     imageName = "new_Support";
     tooltipValue = "Support";
     }
     resultarray = [imageName, tooltipValue];
     } catch (e) {
     console.log(e);
     }
     return resultarray;
    }
  3. Edit the view of desired entity.          custicon_01
  4. Select the column for which the custom icons and tool-tip(s) are to be added and click on “Change Properties”.
  5. Select the web resource to it and enter the function name.custicon_03
  6. Save and publish the changes.
  7. Navigate to the entity and select the view.custicon_04
A blog from Osmosys

1 comment:

Voice of the Customer (VOC) – Dynamics 365 CRM

Tags:   Dynamics 365   Dynamics CRM   feedback   survey   VOC   Voice of customer Introduction To Voice of the Customer For any bus...