You need to sign in to do that
Don't have an account?
Sudeep Singh
How Lookup field can be auto-populated ?
I have a lookup field in Lead object and Contract Object.
Field Name - Service
Lookup with Product.
I need to auto-populate only one product in those lookup field in Lead as well as Contract before creatin record.
When we click on new button at that moment only the lookup field must have "Value" product.
Thanks
Field Name - Service
Lookup with Product.
I need to auto-populate only one product in those lookup field in Lead as well as Contract before creatin record.
When we click on new button at that moment only the lookup field must have "Value" product.
Thanks
Requesting you to go through this discussion which is closest with your requirement -> https://developer.salesforce.com/forums/?id=9060G000000Bh9cQAC
Hope it helps.
Thank you.
All Answers
There are several ways to auto-populate a lookup field in Salesforce. Here are a couple of options:
Use a default value on the field: You can set a default value for the lookup field in the Lead and Contract objects. This will automatically populate the field with the specified product when a new record is created.
Use a trigger: You can create a trigger on the Lead and Contract objects that will automatically populate the lookup field with a specified product when a new record is created.
trigger AutoPopulateService on Lead (before insert) {
for (Lead l : Trigger.new) {
l.Service__c = [SELECT Id FROM Product WHERE Name = 'Value' LIMIT 1].Id;
}
}
Can you please let me know how to set a default value in lookup field, am not getting option for it.
Thanks
Requesting you to go through this discussion which is closest with your requirement -> https://developer.salesforce.com/forums/?id=9060G000000Bh9cQAC
Hope it helps.
Thank you.