function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Akhil Katkam 5Akhil Katkam 5 

Lookupfield related query

Hi Developer Community ,

recently i have copied a code for custom lookup field from github , this is a custom component which have .cmp, .js, .helper and a apex class

what this look up field is , we can keep this lookupfield component in any component like in this way 

 

<aura:component>

 <c:lookupField 
                    objectAPIName="Competition__c" 
                    label="PRIMARY COMPETITION"
                    returnFields="['Name','Opportunity__c']" 
                    queryFields="['Name']"
                    selectedId="{!v.selectedId}"
                    />
</aura:component>

my issue is i kept this lookup field in a component and kept in a opportunity record page , when ever i click on this look up field i need to display only values related to this opportunity record , but it is showing all records irrespective of opportunity record

so i have seen the code in lookupfield.cmp

it looks like this component is built in a way that can be used for any object , but in my case i want to queryfields only related to opportunity record ,

can anyone please tell me how to solve this issue , i will keep the link of the github here

click here for link (https://github.com/Chaos-Tech-Corp/Input-Field-Lookup)

Thanks in advance

 

ANUTEJANUTEJ (Salesforce Developers) 
Hi Akhil,

>> https://www.forcetalks.com/blog/create-a-search-bar-key-to-search-account-name-using-lightning-component/

The above link has an implementation that is similar but is for specific object you can try checking it and modify it to fit your opportunity object instead of the used example.

Let me know if it helps you and close your query by marking it as the best answer so that it can help others in the future.  

Thanks.
Akhil Katkam 5Akhil Katkam 5
Hi Anutej , thanks for the reply , 

the link which u shared is only displays records , but in my task , records need to displayed and i need to select and store that value in an attribute