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

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
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.
JavaScript
JavaScript

JavaScript is a dynamic, object-based language commonly used for client-side scripting in web browsers. Recently, server side JavaScript frameworks have also emerged. JavaScript runs on nearly every operating system and in almost every mainstream web browser.

127K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo