You need to sign in to do that
Don't have an account?
Chitral Chadda
triger contact
triger on account which matches email and phone of the associated account, if both match then only insert contact record else throww error
no debug logs are generate and even though account and contact email, phone are different , the trigger dosent fire .
trigger MatchPhoneonAccount on Contact (before insert) { set<id> accIdset = new set<id>(); for(Contact c :trigger.new) { if( c.accountid!=null) { accIdset.add(c.AccountId); } } map<id,account> accMap = new map<id,account>([Select id,Email__c , Phone from account where id in : accIdset]); for(contact c : trigger.new) { if(c.Email != null && c.Phone != null && accMap != null) { system.debug('*******Email'+c.Email); system.debug('*******Phone'+c.Phone); if(c.Email != accMap.get(c.accountid).Email__c && c.Phone != accMap.get(c.accountid).Phone) { system.debug('*******Dosent Matched'+c.Phone); c.adderror('Your phone and Email does not exists in out database .'); } } } }
no debug logs are generate and even though account and contact email, phone are different , the trigger dosent fire .
is the trigger working absolutely fine fr you ? wer u able to test this
means only if accounts email and phone MATCH to contacts email and phone then only insert that contact record .
is it working on ur org ?
yes i checkd triger is active .. bt dnt knw wats wrong