Good Afternoon,
I am having an issue on a form where on load I retrieve data from the arguments passed through when opening in a dialog and using that data to set lookup fields. The issue I have is when I then use a function to retrieve the value of the lookup the value is not retrieve properly. My code to set the a field from the arguments is below: -
// Function to check if args and set Address from Args
function checkAndSetAddressFromArgs () {
if (window.frameElement && Dialog.getArgs()){
var addressNameId = Dialog.getArgs().addressNameId;
if (addressNameId == null || addressNameId == '' || addressNameId == 'undefined' || addressNameId == 'null') {
fd.field("Address_x0020_Name").value = null;
} else {
fd.field("Address_x0020_Name").value = addressNameId;
}
}
}
If I then try to retrieve the value of the above Lookup for use in another function as per - var addressNameId = fd.field('Address_x0020_Name').value.LookupId;
it is returned as undefined. If I use - var addressNameId = fd.field('Address_x0020_Name').value;
This does return the ID rather than the object…
Help appreciated.