Note that there are some explanatory texts on larger screens.

plurals
  1. POError if I choose not to fill a field value or Option Set value
    primarykey
    data
    text
    <p>ey guys,</p> <p>So basically I have couple of option sets from where I choose a value and based on those value I calculate the result. I have 7 option sets, but it is not necessary that all 7 are used. SO if someone only chooses to use values from 3 of the option sets and leave the rest empty, the user gets the following error.</p> <p><strong>There was an error in the field customized event. Event: onSave Error: Unable to get property 'value' of undefined or null reference.</strong> </p> <p>now I realize that this error means that the other option set values are empty but how do I get past this?</p> <p>I am using javascript to use the value from option set to multiply to a value in text field and get my result. Here is my code</p> <pre><code>function cashTotal() { if (Xrm.Page.ui.getFormType() == 1) { var bill1 = Xrm.Page.getAttribute("inmate_cashbills1").getSelectedOption().value; var bill1Text = Xrm.Page.getAttribute("inmate_cashbill1_text").getValue(); var result1 = bill1 * bill1Text; Xrm.Page.getAttribute("inmate_total1").setValue(result1); var bill2 = Xrm.Page.getAttribute("inmate_cashbills2").getSelectedOption().value; var bill2Text = Xrm.Page.getAttribute("inmate_cashbill2_text").getValue(); var result2 = bill2 * bill2Text; Xrm.Page.getAttribute("inmate_total2").setValue(result2); var bill5 = Xrm.Page.getAttribute("inmate_cashbillls5").getSelectedOption().value; var bill5Text = Xrm.Page.getAttribute("inmate_cashbill5_text").getValue(); var result5 = bill5 * bill5Text; Xrm.Page.getAttribute("inmate_total5").setValue(result5); var bill10 = Xrm.Page.getAttribute("inmate_cashbills10").getSelectedOption().value; var bill10Text = Xrm.Page.getAttribute("inmate_cashbill10_text").getValue(); var result10 = bill10 * bill10Text; Xrm.Page.getAttribute("inmate_total10").setValue(result10); var bill20 = Xrm.Page.getAttribute("inmate_cashbills20").getSelectedOption().value; var bill20Text = Xrm.Page.getAttribute("inmate_cashbill20_text").getValue(); var result20 = bill20 * bill20Text; Xrm.Page.getAttribute("inmate_total20").setValue(result20); var tmp = result1 + result2 + result5 + result10 + result20; Xrm.Page.getAttribute("inmate_cashtotal").setValue(tmp); } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload