i wanted to update a field on contact once i associate a account.
once accountcontactrelation is created i am checking if that relation role is Manager and if yes then only i wanted to update a contact field.
My query is how cani achieve this in before trigger .beacuse if i write after trigger then my trigger is calling twice.Please suggest
and in before insert i am not getting any ACR and if on update I change the ACR then still not getting ACR query
map<id,AccountContactRelation>acrmap=new map<id,AccountContactRelation >();
for(AccountContactRelation acr: [Select id,ContactId,Role__c from AccountContactRelation where (Role__c='Manager) and contactid in:newconMap.keyset() ]) {
acrmap.put(acr.contactid,acr);
}
for(contact con:newconMap.values()) {
if(acrmap.containsKey(con.id))
con.isManager__c = true;
}