Javascript TypeError: Cannot read properties of null (reading ‘getValue’)

0
274
Role Image


Dear All,

I am new to CRM and trying to develop a functionality to show or hide ‘MultiSelect choice’ field based on the value from other field. Since there is a limitiation to achieve this using CRM business rule, I tried using JS to achieve this functionality. But I am facing below error when trying to do this using JS. I have checked all the word spellings and everything is correct.

TypeError: Cannot read properties of null (reading ‘getValue’)

Please find my below JS code. Is it possible to advise what needs to be corrected please?

function HideorShowAccessibilityAdjustments(executionContext)

{
var formContext = executionContext.getFormContext();
if (formContext.getAttribute(“mntr_areanyreasonableadjustmentsrequired”).getValue()!=0) {
formContext.getAttribute(“mntr_AccessibilityAdjustments”).setVisible(true);
formContext.getAttribute(“mntr_NonAccessibilityAdjustments”).setVisible(true);
}
else if (formContext.getAttribute(“mntr_Areanyreasonableadjustmentsrequired”).getValue()!=1) {
formContext.getAttribute(“mntr_AccessibilityAdjustments”).setVisible(false);
formContext.getAttribute(“mntr_NonAccessibilityAdjustments”).setVisible(false);
}
}

Thank You,

Gowtham



Source link

Leave a reply

Please enter your comment!
Please enter your name here