OnChange not changing

I am having issues with the OnChange script below:.

switch (this.value) {

case 'Introduction' :

oppo_certainty.value = '5';

break;

case 'Presentation' :

oppo_certainty.value = '25';

break;

case 'Quoted/Bid' :

oppo_certainty.value = '50';

break;

case 'Negotiated' :

oppo_certainty.value = '75';

break;

case 'Sold Open' :

oppo_certainty.value = '90';

break;

case 'Sold Closed' :

oppo_certainty.value = '100';

break;

I am looking to update the oppo_certainty when a value in the selection list for oppo_stage is chosen. (The stage is required, and to make it easy for the team, we want to update automatically.)

I am putting it in the OnChange box and nothing is happening.

We do not have workflow set as on for Opportunities so, in theory, there should not be a conflict, correct? I have tried multiple ways to get the certainty to update after the stage is changed but to no avail. I think the only way to address this at this point is a table script and I will honestly say ... that is currently above my pay grade. :-/ Or, do you think the OnChange can be tweaked to actually work? Thanks and have a great day!

  • 0

    Dear Debbie,

    We have checked your code and found that you are using caption name to compare the values in your code. Since it is an selection type field, you need to compare it with caption code value.

    You will find the caption code value associated with its caption name at field level. Please follow the below steps.

    1. Go to Administration -> Opportunity -> Fields
    2. Select the field Oppo_Stage and click on selection hyperlink.
    3. Check the caption code of selection values. Refer the below screenshot for your reference.
    4. Now handle the Case condition with caption code values.

    Your revised code snipped would like below.


    switch (this.value)
    {
    case 'Introduction' :
    oppo_certainty.value = '5';
    break;
    case 'Presentation' :
    oppo_certainty.value = '25';
    break;
    case 'Closed' : //'(Instead of Sale Closed)
    oppo_certainty.value = '50';
    break;
    }

    Hope this helps you!

    Regards,
    Dinesh

  • 0

    Debbie

    There is an alternative codeless approach that could be taken. Both the fields oppo_stage and oppo_certainty are displayed in the opportunity status box. The bottom panel in an opportunity summary screen. This is normally managed by workflow. You could use the workflow action "Set Column Value" to set the value of both the oppo_stage and oppo_certainty fields as the workflow progresses. The fields can be made readonly so that this values can not be overridden by the user.

  • 0

    THANK YOU to both of you!!!!! I truly appreciate your willingness to help me learn and get better. :-)