How can I check if a field exists before a function is fired?
n
Nikola Gavric
09/25/2020, 2:22 PM
Depends on the context but you could use N/record and record.load, or you could use currentRecord.. and use .getFields() to get all fields on the record to see if the one you need exists.
p
pen one
09/25/2020, 2:47 PM
so what I am trying to do is hide fields based on a selection made in another field. These fields exists on some custom sales order forms but not others. So if the field is not shown in that form an error pop's us that says TypeError Cannot set property 'isDisplay' of null.
m
mdr
09/25/2020, 3:22 PM
null check your field before setting the isDisplay property.
if(myfield !== null) myfield.isDisplay = false;