Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 82002

Onload Error but OnChange works

$
0
0

Created some JS last week to hide a field option when one option is chosen. It works OnChange and works OnLoad but when I go to open a new record (not when I go to open an existing record) I get the webpage message that says:

"there was an error with this field's customized event.

Field: window

Event: onload

Error: unable to get vlaue of the property 'text': object is null or undefined"

Can you see any issues with this code? What could be potentially making this occur? Could it be because there are historical records with this field already chosen?

function removeMeeting() {

   var removeMeeting = Xrm.Page.data.entity.attributes.get("new_field").getSelectedOption().text;

   if (removeMeeting == "Client") {

       Xrm.Page.getControl("new_action").removeOption(100000002);

   }

   if (removeOTAMeeting == "Prospect") {

       Xrm.Page.getControl("new_action").removeOption(100000002);

   }

}


Viewing all articles
Browse latest Browse all 82002

Trending Articles



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