I have a function that retrieves the value of a lookup Object.
var lookupObject = formContext.getAttribute("attributename");
var selectedRecord = lookupObject.getValue();
It's throwing the error that lookupObject.getValue() is not a function.
the reason is that formContext.getAttribute("attributename")
is not returning an Object.
It is not returning an Object because the field attributename
is not present inside the model-driven app form where you attached the script.