You need to sign in to do that
Don't have an account?
finding domain name from website
On the Account object I have created a formula field called Domain_Name__c . The formula I have used is this,
SUBSTITUTE(Website, LEFT(Website, FIND("www.", Website)), NULL)
Where website is a standard field on Account.
If Website is www.xyzdomain.com or https://www.xyzdomain.com
In Domain_Name__c I expected result as xyzdomain.com
Instead i am getting the result either as
.xyzdomain.com or ww.xyzdomain.com depending on whether the Email entered was 'www.xyzdomain.com' or 'https://www.xyzdomain.com'
Any thoughts how I can only get the text after the .
e.g If, in the field Website I enter www.salesforce.com or https://www.salesforce.com the result in the Domain_Name__c should be salesforce.com
So ok man remove __c and try it it's working fine
SUBSTITUTE(Website, LEFT(Website, FIND(".", Website)), NULL)
If it is helpful plz mark as solution for others it may benfit
All Answers
Hi Try this,
it may helpful for you
SUBSTITUTE(website__c, LEFT(website__c, FIND(".", website__c)), NULL)
If it helpful plz make it as solution for others it may benfit
prem
Thanks for the response but that's the exact formula i have (see my original post).
On Account, the field website is a standard field.
So ok man remove __c and try it it's working fine
SUBSTITUTE(Website, LEFT(Website, FIND(".", Website)), NULL)
If it is helpful plz mark as solution for others it may benfit
I found this formula:
IF(BEGINS(Website, "www."), MID(Website, FIND('www.', Website, 1)+4, (LEN(Website) - FIND('www.', Website, 1)+4)),
IF(BEGINS(Website, "http://"), MID(Website, FIND('http://', Website, 1)+7, (LEN(Website) - FIND('http://', Website, 1)+7)),
IF(BEGINS(Website, "https://"), MID(Website, FIND('https://', Website, 1)+8, (LEN(Website) - FIND('https://', Website, 1)+8)), Website )))
But that doesn't work for websites that start with 'http://www.' I made some adjustments to the formula by adding more IF statements and finally ended up with this.
IF(BEGINS(Website, "http://www"), SUBSTITUTE(Website, LEFT(Website, FIND(".", Website)), NULL),
IF(BEGINS(Website, "https://www"), SUBSTITUTE(Website, LEFT(Website, FIND(".", Website)), NULL),
IF(BEGINS(Website, "www."), MID(Website, FIND('www.', Website, 1)+4, (LEN(Website) - FIND('www.', Website, 1)+4)),
IF(BEGINS(Website, "http://"), MID(Website, FIND('http://', Website, 1)+7, (LEN(Website) - FIND('http://', Website, 1)+7)),
IF(BEGINS(Website, "https://"), MID(Website, FIND('https://', Website, 1)+8, (LEN(Website) - FIND('https://', Website, 1)+8)), Website)))))
Now if I could only figure out a way to build onto this to remove everything AFTER '.com' or '.org'.
This works on the acccount record. It can be added to any other object by changing the 'Website' to the field name containing the URL
if(find("/",if(find("www.",Website)>0,IF(FIND("//",Website)>0,substitute(Website,left(Website,find("//www.",Website)+5),NULL),Website),IF(FIND("//",Website)>0,substitute(Website,left(Website,find("//",Website)+1),NULL),Website)))>0,left(if(find("www.",Website)>0,IF(FIND("//",Website)>0,substitute(Website,left(Website,find("//www.",Website)+5),NULL),Website),IF(FIND("//",Website)>0,substitute(Website,left(Website,find("//",Website)+1),NULL),Website)),find("/",if(find("www.",Website)>0,IF(FIND("//",Website)>0,substitute(Website,left(Website,find("//www.",Website)+5),NULL),Website),IF(FIND("//",Website)>0,substitute(Website,left(Website,find("//",Website)+1),NULL),Website)))-1),if(find("www.",Website)>0,IF(FIND("//",Website)>0,substitute(Website,left(Website,find("//www.",Website)+5),NULL),Website),IF(FIND("//",Website)>0,substitute(Website,left(Website,find("//",Website)+1),NULL),Website)))
Peter, I tried your function but it didn't trim the "www." in the cases where the website just began with a "www."
I ended up doing a hybrid of Eli's function, but to make it WAY more readable and maintainable, I created an intermediate custom formula field named, "Domain Name and Path".
Domain Name and Path Function
Additional Notes
But, if my website is www.google.com/ I would like my formula to disregard the trailing slash at the end and only display: google.com
Any insight is appreciated!
The nice thing is with the two functions working together I can have just return to me which is what I want, especially when trying to match people to accounts or have another field for determining uniqueness for accounts.
The other route that you can go here is to use the Data Loader, or DemandTools to search for trailing slashes and just remove them.
But I need a generic way to extract only google after we got google.com because in my case the account will have different website not specific to .com it can be lot of varities.
To get google.com from http://www.ggogle.com i have used the below if condition which takes care for both https or only www.
IF(OR(BEGINS(Website, "http://www"),BEGINS(Website, "https://www"), BEGINS(Website, "www.")),
SUBSTITUTE(Website, LEFT(Website, FIND(".", Website)), NULL),
IF(BEGINS(Website, "http://"),
MID(Website, FIND('http://', Website, 1)+7, (LEN(Website) - FIND('http://', Website, 1)+7)),
IF(BEGINS(Website, "https://"),
MID(Website, FIND('https://', Website, 1)+8, (LEN(Website) - FIND('https://', Website, 1)+8)),
Website
)
)
)
Any help appreciated !
A basic formula for getting this once you have the domain would be but this assumes the important part is at the beginning. What do you would consider the relevant part of the domain? It might not always be the first part. If an email address or website has a subdomain like
- engineering.google.com
- hr.international.microsoft.com
- math.schoolname.k12.mi.us
how are you going to determine which is the important part? You can't even try to pick out the Top Level Domain like .com, .edu, .net because there are a ton of those (https://www.icann.org/resources/pages/tlds-2012-02-25-en) and sometimes an additional prefix comes before the TLD. So until we can run a series of regexs on some data, I just don't know how you can clean it up enough to get the unique data you'll want to return.For the standard examples though where it's basically I'd suggest you run some workflow rules/field updates to store a temporary/auto-updating value for the domain name and then run the basic function I have listed above.
Found a formula that solves for www, http://, and https:// prefixes... good stuff!
If(BEGINS(Website, "www."), MID(Website, FIND('www.', Website, 1)+4, (LEN(Website) - FIND('www.', Website, 1)+4)),
If(BEGINS(Website, "http://"), MID(Website, FIND('http://', Website, 1)+7, (LEN(Website) - FIND('http://', Website, 1)+7)),
IF(BEGINS(Website, "https://"), MID(Website, FIND('https://', Website, 1)+8, (LEN(Website) - FIND('https://', Website, 1)+8)), Website )))
Here's the post I got it from: https://salesforce.stackexchange.com/a/68812
IF(FIND('/',SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(Website, 'http://', NULL), 'https://', NULL), 'www.', NULL))>0,LEFT(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(Website, 'http://', NULL), 'https://', NULL), 'www.', NULL),FIND('/',SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(Website, 'http://', NULL), 'https://', NULL), 'www.', NULL))-1),SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(Website, 'http://', NULL), 'https://', NULL), 'www.', NULL))
Here is the my comment there:
https://salesforce.stackexchange.com/a/287651/65402
IF(BEGINS(Website, "https://www"), SUBSTITUTE(Website, LEFT(Website, FIND(".", Website)), NULL),
IF(BEGINS(Website, "www."), MID(Website, FIND('www.', Website, 1)+4, (LEN(Website) - FIND('www.', Website, 1)+4)),
IF(BEGINS(Website, "http://"), MID(Website, FIND('http://', Website, 1)+7, (LEN(Website) - FIND('http://', Website, 1)+7)),
IF(BEGINS(Website, "https://"), MID(Website, FIND('https://', Website, 1)+8, (LEN(Website) - FIND('https://', Website, 1)+8)), Website))))
Regards: Swimming pool company in Dubai (https://zarqaainteriorfitout.ae/services/an-accomplished-swimming-pool-company-in-dubai/)
Swimming Pool Company in Dubai (https://www.kabcogroup.com/swimming-pools/)