The Now Platform® Washington DC release is live. Watch now!
‎02-25-2020 01:22 PM
[SCRIPT:EXEC] Error while running Client Script "On Load": TypeError: Cannot set property '_visible' of undefined
Onload client script written on table form is not working in Service Portal after upgrade.
function onLoad() {
if(g_form.isNewRecord())
{
g_form.setSectionDisplay('activity',false);
}
}
Solved! Go to Solution.
‎03-12-2020 01:06 AM
I installed Patch 1 of Orlando release (orlando-12-11-2019__patch1-02-19-2020_02-26-2020_1720), which included PRB1382041, which I described above. I can confirm that the error message will be not more displayed.
The fragment of the code of initGlideForm of spModel, which I described above, is fixed now and it looks like the following
g_form.$private.events.on('propertyChange', function(type, fieldName, propertyName, propertyValue) {
if (propertyName == "mandatory")
$scope.mandatory = c.populateMandatory(flatFields);
if (propertyName == 'messages') {
if (propertyValue && propertyValue.length)
spAriaUtil.sendLiveMessage(propertyValue);
}
if (isCatalogItem && type === "SECTION" && propertyName === "visible") {
var section = _getSection(fieldName);
if (section) {
var mandatoryFields = $scope.mandatory.filter(function(field) {
return field._parent === section.id;
});
if (mandatoryFields.length) {
section.visible = true;
return;
}
var sectionContainer = $scope.formModel._fields[section.id];
if (sectionContainer)
sectionContainer._visible = propertyValue;
}
}
});
The new code fragment with sectionContainer makes the code safe.
‎02-25-2020 01:25 PM
Hi,
You're not able to use that type of setSectionDisplay in regard to the Portal.
Please refer to this link for an alternative method.
Please mark reply as Helpful/Correct, if applicable. Thanks!
‎02-25-2020 01:25 PM
‎02-26-2020 08:34 AM
Changed UI type to Desktop removed error and even the section was not visible on the Portal. Thanks Miguel!!
‎02-26-2020 09:13 AM
AWESOME! I am glad it worked. Can you mark my solution as "correct"? That way other users that have the same issue can see that it work and could help them!
Thanks,
Miguel