Use a percentage on a form

Posted on 2009-02-11
Last Modified: 2012-05-06
Scenario: Our sales staff puts in an estimated value, and probability, which generates a weghted value, when an opportunity is created. They would much prefer entering an actual percentage for the probability, rather than a decimal. How can I set this up and still have CRM calculate the weighted value.

One way which just sprung to mind would be to divide value of the probability by 100, then perform the calculation. I'll test that now, but am still open to suggestions.
Question by:twardnw
    LVL 15

    Assisted Solution

    Sounds like you are on the right track.  Consider a picklist of values that they can choose from (and avoid them saying there is a 69.73%) and these picklist values can have a corresponding pre-created decimal value..

    Not sure this helps if they want to get 69.73% granular....

    Author Comment

    Hmm, hadn't thought of a picklist, that might work. What should the syntax be? Right now I have in the onChange event for the estimated value and probability:

    crmForm.all.new_weight.value = crmForm.all.estimatedvalue.value*crmForm.all.new_probability.value;

    and that generates a NaN value in the weighted value on the form.

    Just talked it over with our sales guy, he is in favor of doing it as a picklist, so I'll start on that, any hints on the syntax for that?
    LVL 15

    Expert Comment

    Basically you're looking for an OnChange or OnSave on the picklist that updates a another value that is either not on the form or hidden on the form.

    So if you pick 10%, it will update the other field.

    Author Comment

    Would I just be referencing it as new_picklist.value ?

    Where value 1 = 0%, value 2 = 5%, value 3 = 10%, etc.

    How would to code for that work? The attributes I am work with are:

    new_weight - this is the calculated value, money type attribute
    estimatedvalue - 'money' type attribute
    new_opp_probabilitypick - picklist of %'s in 5% increments
    new_probability - old probability attribute, I could use this to store the decimal value of each percent.
    LVL 10

    Accepted Solution

    Two quick answers:

    (1) You may want to use a picklist - but associate it with a sales stage.  This way, the % is always associated with the stage that the opportunity is in (this is the typical way that businesses do this).  For example:
    Discovery         5%
    Presentation    15%
    Demo                50%
    Quote               75%

    Using this approach, you can change the percentage based on a picklist (i.e. Sales Stage) - but allow the user the further control to update it based upon their own evaluation.

    (2) The javascript to handle this would be the same either way (you could also use a workflow, which is even easier, but I'll leave that up to you).  JavaScript is below.  You'll need to modify this to update the secondary field that, I think, you want to use for tracking a percentage...but this could should be a suitable starting point for you.  In this particular case, I inserted this code behind the Sales Stage picklist on the Opportunity form.
    switch (crmForm.all.salesstagecode.SelectedText)
          case "Prospect":
                    crmForm.all.closeprobability.DataValue = 15;
          case "Qualify":
                    crmForm.all.closeprobability.DataValue = 20;
          case "Develop":
                    crmForm.all.closeprobability.DataValue = 30;
          case "Solution / BPA":
                    crmForm.all.closeprobability.DataValue = 50;
          case "Proof":
                    crmForm.all.closeprobability.DataValue = 85;
          case "Close":
                    crmForm.all.closeprobability.DataValue = 90;
                    crmForm.all.closeprobability.DataValue = 0;

    Open in new window


    Author Closing Comment

    Thanks guys, exactly what I was needing, got it working perfectly now!

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    Join & Write a Comment

    This is a walkthrough guide I wrote whilst upgrading my on-premise MS Dynamics CRM 3.0 deployment to 4.0. This covers the actual installation of the product to a working level for my system, I ran into a lot of issues that the steps below fixed so h…
    On Sep 22nd 2014 Microsoft released Update Rollup 1 for Microsoft Dynamics CRM 2013 Service Pack 1 and back in July Update Rollup 3 was released.  So we now have:   Update Rollup 1Update Rollup 2Update Rollup 3Service Pack 1Update Rollup 1 for S…
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    732 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now