You need to sign in to do that
Don't have an account?

How to parse the street number out of the Street Address in Leads?
In our organization we use the LastName, FirstName and the street address number as the name of the opportunity. For example "Lastname, Firstname1234". Because this is not the default Opportunity name when you convert a lead into an Opportunity, my users need to type this every time they convert a lead. I created a custom convert button, and use a custom URL to load the LastName and the FirstName into the Opportunity Name field, but can anyone help me extract the street number from the street address and add it to the Opportunity Name? My custom URL looks like this:/lead/leadconvert.jsp?retURL={!Lead.Id}&id={!Lead.Id}&noopptt={!Lead.LastName&", "&Lead.FirstName}
Use following code -
{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/29.0/apex.js")}
var check = '{!Lead.Street}';
var res = check.split(" ");
window.open('/lead/leadconvert.jsp?retURL={!Lead.Id}&id={!Lead.Id}&noopptt={!Lead.LastName&", "&Lead.FirstName}'+ res[0]);
Here is the settings screen shot for your reference -
I hope, this will solve your problem. If this solves your problem then Mark this question and choose best answer.
Regards,
Santosh Chitalkar
All Answers
You can try using javascript. Follow the steps given below -
1) In javascript, get the Lead.Street and store it in string variable.
2) Use split method to get only street no and store it in variable say 'StreetNum'
3) use window.open(url)
like
window.open(url)
/lead/leadconvert.jsp?retURL={!Lead.Id}&id={!Lead.Id}&noopptt={!Lead.LastName&", "&Lead.FirstName&", "&StreetNum }
Mark this question as solved if this helps you and solve your problem
Regards,
Santosh Chitalkar
Use following code -
{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/29.0/apex.js")}
var check = '{!Lead.Street}';
var res = check.split(" ");
window.open('/lead/leadconvert.jsp?retURL={!Lead.Id}&id={!Lead.Id}&noopptt={!Lead.LastName&", "&Lead.FirstName}'+ res[0]);
Here is the settings screen shot for your reference -
I hope, this will solve your problem. If this solves your problem then Mark this question and choose best answer.
Regards,
Santosh Chitalkar