You need to sign in to do that
Don't have an account?
Jayesh Bhatnagar
How to default a value to lightning:inputField lookup field?
I have a custom lightning component to create opportunities. This lightning component uses a lightning:recordEditForm and within it has a lightning:inputField lookup field. Everything is working fine. I am able to lookup an Account with the lightning:inputField lookup field and select a value and save the opportunity. My question is how do I default a value for the lightning:inputField lookup field? I am able to do this for the other text fields by specifying the value in my component. But there is no documentation for the lookup field defaulting. What is the format for this? Is it possible?
Use the above code ...
https://help.salesforce.com/articleView?id=000268561&language=en_US&type=1
The help link referenced above states that the defaulting will not work for quick actions. In my case I am overriding the standard new opportunity button with my component using lightning:actionOverride. Does overriding a standard button also qualify as a quick action?
The force:inputField default does work when I add my component to the account lightning page. But my scenario is to override the new opportunity button. So still looking for answers. Any other suggestions?
You should be able to default the lookup field by setting the recordId in the value
Thanks
or
if you are using action from account to create opportunity with the account lookup, the value can be set from force:hasRecordId which will give you the recordId of the account.