Solved

# Use a percentage on a form

Posted on 2009-02-11
778 Views
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.
0
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....
0

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?
0

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.
0

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.
0

LVL 10

Accepted Solution

(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:
STAGE    PROBABILITY
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;

break;

case "Qualify":

crmForm.all.closeprobability.DataValue = 20;

break;

case "Develop":

crmForm.all.closeprobability.DataValue = 30;

break;

case "Solution / BPA":

crmForm.all.closeprobability.DataValue = 50;

break;

case "Proof":

crmForm.all.closeprobability.DataValue = 85;

break;

case "Close":

crmForm.all.closeprobability.DataValue = 90;

break;

default:

crmForm.all.closeprobability.DataValue = 0;

break;

}
``````
0

Author Closing Comment

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

## Featured Post

### Suggested Solutions

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 (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…