﻿<!DOCTYPE html><html lang="en"><head>
<meta charset="utf-8">
<title>Single View Helper 1</title>
<style>
body {
    background-color: transparent;
    margin: 0px 5px 0px 5px;
    padding: 0px 5px 0px 5px;
    font-family: Segoe UI,Tahoma,Arial;
    font-size: 12px;
}
h3 {
    color: #666666;
    font-family: "Segoe UI",Tahoma,Arial;
    font-weight:bold;
    display: block;
    height: 15px;
    margin-bottom: 10px;
}
.leftCol {
    display: block;
    width: 45%;
    float: left;
    margin-right: 5px;
}
.rightCol {
    display: block;
    width: 45%;
    float: left;
}
.blockme {
    margin: auto;
    display: block;
}
.msIntro {
        margin-bottom: 5px;
}
.msExplain {
        margin-bottom: 5px;
}
</style>
</head>
<body>
    <div class="leftCol">
        <h3 class="selected">SETTING COLOR WITH A CUSTOM FUNCTION</h3>
        <div id="settingColor" class="blockme">
            <div class="msIntro">
                When selecting <b>Custom JavaScript Function</b> as the Color source, you need to implement a Javascript function
                on the form that returns the CSS color name or color value. It must have the name and calling interface as per the example below: 
            </div>
            <pre>
    function determineCustomColor(record, entityLogicalName) {
        // Return green for Open opportunities, gray for Won or Lost
        if (entityLogicalName == "opportunity") { 
            return (record.StatusCode.Value == 0) ? "DarkGreen" : "#777777";
        }
    }
            </pre>
            <div class="msIntro">
                 The input parameter <b>record</b> is a Javascript object. Each of the fields retrieved according to the tab's tile
                 definition is a property of this object, e.g. <b>record.Name</b>, <b>record.CloseProbability</b> or <b>records.StatusCode</b>.
                 Option Sets, Currency Fields and Lookup fields are objects in their own right, use notation like <b>record.ParentContactId.Name</b>
                or <b>record.StatusCode.Value</b>.
            </div>
            <div class="msIntro">
                The input parameter <b>entityLogicalName</b> is a string containing the logical name for the entity, e.g. <b>opportunity</b> or <b>incident</b>.
            </div>
        </div>
    </div>
   <div class="rightCol">
       <h3 class="selected">SETTING THE ICON WITH A CUSTOM FUNCTION</h3>
       <div id="Div1" class="blockme">
           <div class="msIntro">
               When selecting <b>Custom JavaScript Function</b> as the Icon source, you need to implement a Javascript function
                on the form that returns the Icon name. It must have the name and calling interface as per the example below: 
           </div>
           <pre>
    function determineCustomIcon(record, entityLogicalName) {
        // Return a flag icon based on Address 1 Country
        if (entityLogicalName == "account") { 
            switch (record.Address1_Country) {
               case "United States:
               case "United States": return "Flags/" + "UnitedStates.png";
               case "United Kingdom": return "Flags/" + "UnitedKingdom.png";
               case "Germany": return "Flags/" + "Germany.png";
               default: return "Temp.png";
            }
        }
    }      </pre>
           <div class="msIntro">
               The input parameters are the same as for the <b>determineCustomColor</b> function on the left.
           </div>
       </div>
   </div>  
</body>
</html>