Asked by:
error: unable to get property set visible of undefined or null refrence

Question
-
HI all,
I am getting the error "error: unable to get property set visible of undefined or null refrence".
the script which is used in dev is working perfectly as expected, but when i am using the same in production it is throwing me the above error.
thanks in advance
Tuesday, December 2, 2014 8:28 AM
All replies
-
post the relevant part of the code.
probably you are referring to a field that is not in the form anymore
My blog: www.crmanswers.net - Rockstar 365 Profile
Tuesday, December 2, 2014 8:34 AM -
HI,
Please find the code below
function Call_FieldVisibility()
{
var objRegarding = Xrm.Page.getAttribute('regardingobjectid');
var regardingEntityType = '';
if (objRegarding != null){
var aryRegarding = objRegarding.getValue();
if (aryRegarding != null){
regardingEntityType = aryRegarding[0].entityType;
}
}var userGroupName = '';
userGroupName = CEI.CurrentUser.GetValue_Name("new_groupid");
if (regardingEntityType == "lead" && userGroupName == "test")
{
Xrm.Page.getControl("new_come").setVisible(true);
Xrm.Page.getControl("new_attempt").setVisible(true);Xrm.Page.getAttribute("new_come").setRequiredLevel("required");
Xrm.Page.getAttribute("new_attempt").setRequiredLevel("required");
}
else
{
if (Xrm.Page.getAttribute("new_come") != null){
Xrm.Page.getAttribute("new_come").setRequiredLevel("none");
}
if (Xrm.Page.getAttribute("new_attempt") != null) {
Xrm.Page.getAttribute("new_attempt").setRequiredLevel("none");
}Xrm.Page.getControl("new_come").setVisible(false);
Xrm.Page.getControl("new_attempt").setVisible(false);
}
}- Edited by Vandana Reddy Wednesday, December 3, 2014 6:49 AM
Tuesday, December 2, 2014 11:16 AM -
one of these two fields is not in the form
Xrm.Page.getControl("new_come").setVisible(true);
Xrm.Page.getControl("new_attempt").setVisible(true);My blog: www.crmanswers.net - Rockstar 365 Profile
Tuesday, December 2, 2014 12:51 PM -
Run the debugger to check which line is throwing the error.
Regards, Saad
Tuesday, December 2, 2014 12:56 PM -
Hi,
Always check field should be on form.
if (Xrm.Page.getAttribute("new_come") != null){
Xrm.Page.getControl("new_come").setVisible(true);
}
if (Xrm.Page.getAttribute("new_attempt") != null) {
Xrm.Page.getControl("new_attempt").setVisible(true);
}Thanks!
- Proposed as answer by Kalim Khan Wednesday, December 3, 2014 6:18 AM
Tuesday, December 2, 2014 12:59 PM