Sunday, December 4, 2016

Dynamics 365 View Enhancement - Link Web Resources to a View Column

There a several new features in Microsoft Dynamics 365, now we can easily link Web Resources to a column in a view for adding icons and tooltips:




Sample:

The following sample code displays icons and tooltips based on one of three values (1: Hot, 2: Warm, 3: Cold) in the opportunityratingcode (Rating) attribute. The sample code also shows how to display localized tooltip text. For this sample to work, you must create three image web resources with 16x16 images in your Dynamics 365 instance with the following names: new_Hot, new_Warm, and new_Cold.
function displayIconTooltip(rowData, userLCID) {    
    var str = JSON.parse(rowData);
    var coldata = str.opportunityratingcode_Value;
    var imgName = "";
    var tooltip = "";
    switch (coldata) {
        case 1:
            imgName = "new_Hot";
            switch (userLCID) {
                case 1036:
                    tooltip = "French: Opportunity is Hot";
                    break;
                default:
                    tooltip = "Opportunity is Hot";
                    break;
            }
            break;
        case 2:
            imgName = "new_Warm";
            switch (userLCID) {
                case 1036:
                    tooltip = "French: Opportunity is Warm";
                    break;
                default:
                    tooltip = "Opportunity is Warm";
                    break;
            }
            break;
        case 3:
            imgName = "new_Cold";
            switch (userLCID) {
                case 1036:
                    tooltip = "French: Opportunity is Cold";
                    break;
                default:
                    tooltip = "Opportunity is Cold";
                    break;
            }
            break;
        default:
            imgName = "";
            tooltip = "";
            break;
    }
    var resultarray = [imgName, tooltip];
    return resultarray;
}

This results in displaying icons with tooltips in the Rating column that depend on the value in each row. The result could look like this:



1 comment:

  1. Thank you for helping people get the information they need. Great stuff as usual. Keep up the great work!!!
    Microsoft Dynamics 365

    ReplyDelete

Unexpected Error When Replying or Forwarding an Email

Recently came across an interesting issue from one of my clients, they were working fine since around 2 years ago with no issues, using Dyn...