You need to sign in to do that
Don't have an account?
Gary Payne 2
Many times a CSR does not acquire the prospect's Last Name when creating a new Lead record. For this reason I need a way to pre-populate the Lead's Last Name field with a value like "Customer" so the new record can be saved, as Last Name is a required field. The CSR can always overwrite the Last Name field value either before or after saving the initial record. I tried to create a workflow that adds the text "Customer" to the Lead's Last Name field if the value in the Last Name field was just the letter "a", but it is firing and overwriting any value entered into the Last Name field upon saving the record. The workflow was set to fire only when a new record was created. Any suggestions would be appreciated.
How to pre-populate the Lead's Last Name field when creating a new Lead record?
Many times a CSR does not acquire the prospect's Last Name when creating a new Lead record. For this reason I need a way to pre-populate the Lead's Last Name field with a value like "Customer" so the new record can be saved, as Last Name is a required field. The CSR can always overwrite the Last Name field value either before or after saving the initial record. I tried to create a workflow that adds the text "Customer" to the Lead's Last Name field if the value in the Last Name field was just the letter "a", but it is firing and overwriting any value entered into the Last Name field upon saving the record. The workflow was set to fire only when a new record was created. Any suggestions would be appreciated.
if(LastName = "a", "Customer", LastName). This formula allows the user to save the new Lead record with the value of "a" in the Last Name field and then updates the Last Name field with "Customer". It only fires on new Lead creation. If a regular Last Name is entered, not just "a", in the new Lead record then the Last Name field is not updated.
All Answers
The workflow approach is right for your scenario. Make sure you have set the workflow evaluation criteria is set to when record is "created" .
You can set rule criteria that when lastName of lead is null,the workflow should be fired.
This will ensure the LastName field is populated when record is created with empty lastName.
Related: https://help.salesforce.com/articleView?id=workflow_rules_define.htm&type=5
https://salesforce.stackexchange.com/questions/288662/auto-populate-the-company-field-during-lead-creation
Hope this helps you. Please mark this answer as best so that others facing the same issue will find this information useful. Thank you
Thank you for the quick reply. Unfortunately the new Lead record cannot be saved if the Last Name field is null, as it is a required field. Your workflow solution will work for the other fields that are not required fields because a new Lead record can be saved with null valued non-required fields. My challenge is how to populate a required Last Name field on a new Lead record with a text string , like "Customer", before the record is saved for the first time. I'm wondering if this is possible with a Lead Trigger, using the Before Insert action.
I think your requirment is that whenever the user create a new lead then lastName must be populated with 'Customer'.
so you can write a trigger on before insert action on lead object.
try this following trigger. let me know if it's works and mark the best so that it can help to others.
Thank You
Last Name in Leads is a compulsory Salesforce field and in the Save Order that will execute before any Trigger or Flow automation.
Next issue is that it is one of those standard fields that doesn't allow a default value so you can't by-pass it that way.
So, if you really want this behaviour (i.e. that the person creating the lead doesn't need to enter a last name) you will have to create a customisation of some description. For example, a VF page which displays the fields and passes to a controller to create the Lead in the back end. Or you could create your own Lead object, but note you will lose alot of the standard Lead functions if you do this.
Personally, I like saying NO to my customer and I would say that its in the too hard basket for possible return of investment. And then get the customer to really think about what they are trying to do with Leads.
regards
Andrew
Please fill up the last name fill with any string value like 'xyz' before save Lead record and after save lead the last Name will be populate with customer. If any required field is not filled up in record then trigger is not excuted.
so fill up the lastName with any string value and after insert the lead record's lastName will be customer.
First You should Fill up Required LastName and see the Lead's Record LastName With Customer In after Insert Case. I have tried this requirment on my org and where it is working good.
Let Me know this time your issue is solved or not.
Thank You
if(LastName = "a", "Customer", LastName). This formula allows the user to save the new Lead record with the value of "a" in the Last Name field and then updates the Last Name field with "Customer". It only fires on new Lead creation. If a regular Last Name is entered, not just "a", in the new Lead record then the Last Name field is not updated.