Don't have an account?
Search for an answer or ask a question of the zone or Customer Support.
You need to sign in to do that
Sign in to start searching questions
Signup for a Developer Edition
Sign in to start a discussion
You have to develop trigger on Contact object. Get substring between @ and .com. Find the account id using the account name.
--
Magulan Duraipandian
www.infallibletechie.com
trigger AssociateContact on Contact (before insert) {
List<String> contactEmaildomains = new List<String>();
for(Contact contact:Trigger.new){
contactEmaildomains.add(contact.Email_Domain_Name__c);
}
List<Account> accounts = [
SELECT
Id, Website_Domain_Name__c
FROM
Account
WHERE
Website_Domain_Name__c IN :contactEmaildomains
];
Set<String> accountWebsitedomains = new Set<String>();
for(Account account:accounts){
accountWebsitedomains.add(account.Website_Domain_Name__c);
}
for(Contact contact:Trigger.new){
if(accountWebsitedomains.contains(contact.Email_Domain_Name__c)){
contact.Account.Id = ??????(Need Account Id);
}
}
}