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
Jeff SusichJeff Susich 

Custom Lead Button to pre-populate the Lead "Website" field

I want to create a new custom button to replace the standard "New" button on Leads. This button will pre-populate the Lead "Website" field with the domain that the user entered on the "email" field. I don't want the "website" field to display on the initial record creation if possible, because it gets pre-populated and I don't want users typing in data. 

For example, if the new Lead has an email of "jeff@xyz.com", then the "website" field will be "www.xyz.com". They can edit it after the new Lead is created. 

 

Jason Curtis NBSFDGJason Curtis NBSFDG
Hi, Jeff, there are a couple of ways to do this. You can create a custom button related to some Apex, or you can create a flow that guides users through the lead creation process, and you can control how the data is populated. What are you comfortable working in? JavaScript, Apex, Salesforce declarative framework?
Jeff SusichJeff Susich
I am using Professional Edition  for this one, so no Apex. I've created a similar button before using a URL format, but I'm not good at it. 
Jason Curtis NBSFDGJason Curtis NBSFDG
Hmmm, tricky, the best way would be an Apex trigger, but is out of the question since you are PE, you can't use workflow. And you don't want to do a formula field because you want the user to be able to edit it afterwards. You could possible create two website fields, one based on a formula, it will auto-create based off an email unless there is a user-entered URL in the Website2 field. Would that work?
Jeff SusichJeff Susich
There is a way to do it. I just have to spend time with it. I created such a button that prepopulated an a Custom Object record creation, and I guess I'll have to modify that one. I was hoping some smart person had this on the proverbial "tip of their tongue".