Quantcast
Channel: CRM Development forum
Viewing all articles
Browse latest Browse all 9244

Code is returning error Object is null or undefined when the value exists

$
0
0

When I attempt to run my code I get an error that the value is null or undefined. However, the alert line returns the correct value of the field I'm looking up. I have debugged the code and the var ratePercentage remained undefined, but the line before that correctly pops up a message box with the value of the field. What am I doing wrong? I've tried several different variations of code to get the value there but all return null or undefined?

Thanks for any help.

<Message>Unable to get value of the property 'new_CommissionRate': object is null or undefined</Message>
   <Line>25</Line>

var _rate = this.parent.JSON.parse(_retrieve.responseText).d;
            alert(_rate.new_CommissionRate); var ratePercentage = _rate.result.new_CommissionRate.getValue();
            Xrm.Page.getAttribute("new_commissionpercentage").setValue(ratePercentage);
            Xrm.Page.getAttribute("new_commissionpercentage").setSubmitMode("always");   


Viewing all articles
Browse latest Browse all 9244

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>