Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 82002

Rating/Percentage Opportunity

$
0
0

I have a custom field in the opportunity entity called Percentage % which is a drop down with 10%,25%,50%75% and 95% originally there was a script in place that of you chose from the drop down the the rating would change to Pipeline, Best Case or Commit. For some reason it stopped working and I am not sure why. The script is as follows: not sure what is wrong

// changing rating and probability
function updateRating() {
    var nvsProbability = "nav_probability"
    var nvsRating = "opportunityratingcode"

    try {
        var nvsProbabilitySelection = Xrm.Page.getAttribute(nvsProbability).getSelectedOption().text;
        if (typeof (nvsProbabilitySelection) != "undefined" && nvsProbabilitySelection != null) {
            if (nvsProbabilitySelection == "95%") {
                Xrm.Page.getAttribute("opportunityratingcode").setValue(parseInt("1"));
            }
            else if (nvsProbabilitySelection == "75%") {
                Xrm.Page.getAttribute("opportunityratingcode").setValue(parseInt("2"));
            }
            else {
                Xrm.Page.getAttribute("opportunityratingcode").setValue(parseInt("3"));
            }
        }
    }
    catch (err) {
        // there is no selection
        Xrm.Page.getAttribute("opportunityratingcode").setValue(parseInt("3"));
    }
}


Viewing all articles
Browse latest Browse all 82002

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>