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
Vladimir BessonovVladimir Bessonov 

how to find record by record id in lookup field

I am struggling with how to search with record id in lookup field? 
it is wastful to create extra field for the name and have auto enumaration for name 

I found an option to change search layout - add some other field there, but it still looks only for name ? is there any workaround? to me Record is explicit enough to find the record. 
PriyaPriya (Salesforce Developers) 
Hi Vladimir,

Can you kindly provide more detail on this ?
Suraj Tripathi 47Suraj Tripathi 47
Hi Vladimir Bessonov,

You can query your contact using accountId, Here AccountId Field is a lookup field for Contact.
Suppose we have an 'accId' variable that holds the Account Id of Account 'XYZ'.
Then You can Search Contact related to XYZ Account like follows 

List<Contact> conList = [ Select Id, LastName, email, AccountId from Contact where AccountId = :accId] //here accId hold the record Id of XYZ Account.

If you find your Solution then mark it as the best answer. 

Thanks and Regards
Suraj Tripathi.
Baya AdamBaya Adam
MyArticles is a writer’s community where writers can share their stories all over the world. Signup and share your stories to all over the world. Follow your favorite writers, create groups, forums, chat, and much much more!
 
mukesh guptamukesh gupta
Hi Vladimir,

if you are using Standard lookup then you can only search by name, if you want to search with Id then you need to create custom ligghtning component or VF page

if you need any assistanse, Please let me know!!


Kindly mark my solution as the best answer if it helps you.

Thanks
Mukesh
gfdshbg grftdbggfdshbg grftdbg
I think you should need to learn about the step by step procedure about it from here (https://removalswakefield.co.uk/) to set record by record Id focus on the last three steps.