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

New to salesforce : Using Lookup to populate a hidden id field

I have a custom object which for instance has a product_id field. I want to have a lookup  field in my UI

that displays a list of all products and when i select one of the products, the value displayed in my field on the UI should be the product name while behind the scenes i want the product_id from the lookup to be stored on my custom object. Can this be done using native UI without using visualforce?

the problem I am grappling with is that I do not want to create a product_name field on my custom object since I only want to store the ids when i save my object.


Please bear with me if this is a basic question since i am new to visualforce and salesforce.




Best Answer chosen by Admin (Salesforce Developers) 

The native Lookup field works exactly the way as you described. You will see product name in UI, but behind the scene, in the code it actually stores the product id.