
Hi
I'm doing a simple test for null in JavaScript of a lookup field. I'm getting an error every time.
Can someone tell me what my obvious error is?
Every time my error message is Cannot read property 'getValue' of null
if (leadsource != null) {
leadsource= fc.getAttribute("leadsource").getValue()[0].name;
}
I've also tried
if (leadsource != null || leadsource.length > 0) {
leadsource= fc.getAttribute("leadsource").getValue()[0].name;
}
and
if (leadsource != null || leadsource.length > 0 || leadsource == undefined) {
leadsource= fc.getAttribute("leadsource").getValue()[0].name;
}
Thanks
Lee
Hello Lee,
Can you please provide the full code? Can you please confirm that field 'leadsource' is on the form? It seems that this leadsource field is out-of-box. What entity is it on?