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

Duplication of website
How can i ignore the www. for not showing an error example (www.yahoo.com = yahoo.com; www.cs.org != www.cs.ph)
here is duplication method for my website. Thanks in advance
public static void checkDuplicateWebsite(List<Account> newRecord){
for(Account a: newRecord){
List<Account> account = [SELECT Id, Website FROM Account WHERE Website=:a.Website];
if(account.size()>0){
a.adderror('You cannot create a duplicate Website');
}
}
here is duplication method for my website. Thanks in advance
public static void checkDuplicateWebsite(List<Account> newRecord){
for(Account a: newRecord){
List<Account> account = [SELECT Id, Website FROM Account WHERE Website=:a.Website];
if(account.size()>0){
a.adderror('You cannot create a duplicate Website');
}
}
I think to remove WWW use substring. Before using convert to string.
Thanks
Shaijan
How can i put substring in if else statement?
sorry im newbie here
AJ
You can use String methods such as replace
eg:
And @Shaijan is right remove SOQL from the loop.
Thanks
Ankit Maini
AJ
Try now
Thanks it works. but how can i ignore the www. when adding an account website?
Thanks for help!
AJ
try this
Thanks
Shaijan
The code don't have any error but the validation is not working. when i create a account with a website of 'www.fb.com' and i created another account with 'fb.com' it should show a error message.
Thanks for Help!
AJ
Thanks
Shaijan
The validation doesnt work.
Thanks for Help!
AJ
Sir Shaijan in your code.. when i create an account with 'www.google.com' and i created another account with 'www.google.com' its not showing any error. I think that's the missing. how can i fix the code for that thanks
Thank you for help!
AJ
Thanks
Shaijan
Your code work when i create an account with 'google.com' then i created another account with 'www.google.com' it shows an alert message but when add in vice versa it doesn't show an error and add.
Thanks
AJ
Sir Shaijan it doesn't work too
Thanks
AJ
As per your comment:
You have to create a trigger for it and remove the WWW from url everytime it insert or update and that will solve your problem.
When i am applying for Google Ads i am facing the Issu like Duplicate Content so Duplicate Content of Duplicate Website is the Same Error?
Here is the Link of my Website : https://serialgossip.in/
By incorporating these additional checks, the code will correctly handle the provided website URL "https://heypune.com" and ignore the "www." prefix during the duplicate website check.