Use a percentage on a form

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.
Who is Participating?
crm_infoConnect With a Mentor Commented:
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

WilyGuyConnect With a Mentor Commented:
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....
twardnwAuthor Commented:
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?
Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

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.
twardnwAuthor Commented:
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.
twardnwAuthor Commented:
Thanks guys, exactly what I was needing, got it working perfectly now!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.