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
trigger ContactUpdate on Contact (after insert) { set<Id> acctIds = new set<Id>(); for(Contact con : trigger.new) { acctIds.add(con.AccountId); } List<Account> accs = [Select Id ,uniquemailing__c , (Select Id, LastName ,MailingCountry from Contacts) from Account where Id in :acctIds] ; for(Account a :accs){ Set<String> cnons = Set<String>() ; for(Contact c :a.Contacts){ cnons.add(c.MailingCountry); } String strCntry = ''; for(String s:cnons) { strCntry += (strCntry == ''?'':',')+s; } idString = idString.substring(0, idString.length()-1); a.uniquemailing__c = idString ; } Update accs; }