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.
Microsoft DynamicsJavaScript

Avatar of undefined
Last Comment
Performance_Improvements

8/22/2022 - Mon
Chinmay Patel

What happens when you try to execute this? Also how familiar you are with JavaScript and XRM Page object model?
ASKER CERTIFIED SOLUTION
Feridun Kadir

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
ASKER
Performance_Improvements

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.
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23