Hi,
I am get the Id of the Lookup Field on the form with JavaScript. This code works with other Lookup fields on different forms, but not with this one. It is odd. The id field is blank which I have never seen before.
Hi,
I am get the Id of the Lookup Field on the form with JavaScript. This code works with other Lookup fields on different forms, but not with this one. It is odd. The id field is blank which I have never seen before.
Hi,
The issue above is that your field might not be on the form or have a value possibly. A good check to do is first get the field, then check if the field is null or undefined and then attempt the getValue() function after that check. So for example:
var field = formContext.getAttribute("someField"); if(field !== null || field !== undefined){ var fieldValue = field.getValue(); if(fieldValue !== null) { //do something with the value } else { //output and error alert or something else } } //Shorthand check for value could be this as well var field = formContext.getAttribute("someField"); var fieldValue = (field !== null || field !== undefined) ? field.getValue() : null; if(fieldValue !== null) { //do something with the value } else { //output and error alert or something else }
Hope this helps. Please mark as verified if you have found that this is a solution.
I have already tried that. I get the same result.
Hi,
Not sure if this works but give it a try...
Remove field from the form and then publish your changes. Now again add the same field on the form and publish the changes.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,280 Super User 2024 Season 2
Martin Dráb 230,235 Most Valuable Professional
nmaenpaa 101,156