Link to home
Start Free TrialLog in
Avatar of Performance_Improvements
Performance_Improvements

asked on

CRM 2011 JavaScript "Weighted Value" Any help is really appreciated.

Good day,

I've been stuck on this for days now and I can't make any progress.

I'm trying to create a OnChange event to trigger when the OptionSet is changed to calculate a new weighted value i.e.-

value * probability /100 = new read only field

value =                        Currency                     "estimatedamount"
probability=                OptionSet(25/50/75)   "leadqualitycode"
new read only field=   Currency                    "pi_weightedestvalue"

I've created a Web Resource with the following Java...however I'm further away now than I was three days ago.

---------------------------------------------------------------
function UpdateField() {


est = Xrm.Page.GetAttribute("estimatedamount").getValue();
prob = Xrm.Page.GetAttribute("leadqualitycode").getValue();



if(est.getValue() != null)

{

Xrm.Page.GetAttribute(pi_weightedestvalue).setValue( est * prob * 0.01)


Xrm.Page.getAttribute("pi_weightedestvalue").setSubmitMode("always");

}
---------------------------------------------------------------

Any help is hugely appreciated.

Regards,

Craig.
Avatar of Chinmay Patel
Chinmay Patel
Flag of India image

What happens when you try to execute this? Also how familiar you are with JavaScript and XRM Page object model?
ASKER CERTIFIED SOLUTION
Avatar of Feridun Kadir
Feridun Kadir
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
Avatar of Performance_Improvements
Performance_Improvements

ASKER

Thank you Feridun,

You are my hero, your solution worked perfectly first time. I now get a weighted value that saves correctly and without errors.  

Kindest regards,

Craig.