Link to home
Start Free TrialLog in
Avatar of Wizard_IT
Wizard_ITFlag for United Kingdom of Great Britain and Northern Ireland

asked on

CRM 2011 - JScript Math Calculation (Weighted Probability)

On CRM 2011 I have an Opportunites form (standard)

I have created 4 new fields
1) Estimate High (new_estimatehigh)
2) Estimate Low (new_estimatelow)
3) Probability (%) (new_probability)
4) Weighted Probability (new_weightedprob)

I Basically need the following calculation to be done =Probability%*(Est.High+Est.Low)/2

I then need the answer to appear in Weighted Percentage

I would like this done in JScript as the workflows are pretty useless unless anyone can suggest otherwise?
Avatar of stacko111
stacko111
Flag of United Kingdom of Great Britain and Northern Ireland image

Try putting this code in the OnChange event of fields 1-3 and also on the OnLoad event of the form:

crmForm.all.new_weightedprob.DataValue = crmForm.all.new_probability.DataValue * (crmForm.all.new_estimatehigh.DataValue + crmForm.all.new_estimatelow.DataValue)/2;
Avatar of Wizard_IT

ASKER

I get the following error:

Field: Window

Event: onload

Error:Object Expected
Are all those field names correct? Also are they all int fields or are some picklists or something else?
new_estimatelow/new_estimatehigh - Currency Precision
weightedprob - Decimal Number
closeprobability - Whole Number

I have double checked all of the names (probability is closeprobability which I renamed in the line of code)

The System Field (closeprobability) is the only field that when you make a change it doesn't throw an error. All the other fields just show an error (Error: Object Expected)

ASKER CERTIFIED SOLUTION
Avatar of stacko111
stacko111
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of Chinmay Patel
Chinmay Patel
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial