I have javascript that is checking multiple fields in Dynamics CRM. If some of them or all are "1" it will use the highest value to use in a calculation. I pasted a part of the script:
var level1 = {
percentage: 0,
label: "MyLabel"
}
var level2 = {
percentage: 0,
label: "MySecondLabel"
}
if (Xrm.Page.getAttribute("conditioninterested").getValue() == 1) {
level1[0] = 50;
}
if (Xrm.Page.getAttribute("revenueconditionquote").getValue() == 1) {
level2[0] = 70;
}
var chance = Math.max(level1[0],level2[0]);
How do I get the corresponding label after the Math.max found out the percentage to use?