Skip to content

Instantly share code, notes, and snippets.

View chrismdavis85's full-sized avatar

Chris Davis chrismdavis85

View GitHub Profile
@chrismdavis85
chrismdavis85 / gist:6d38fded32fedf3420a8
Last active August 29, 2015 14:04
DirectContactProhibited
trigger DirectContactProhibited on Contract__c (after insert, after update) {
Contract__c Con = Trigger.new[0];
// Pull the parent account
Account TheAccount = [Select id, Direct_Contact_Prohibited__c from Account where id =:Con.Contracting_Entity__c];
// There will be no related contracts/accounts at the time a new contract is created, so only need to update the Account object
if (Trigger.isInsert){
if (Con.Direct_Contact_Prohibited__c == TRUE){
TheAccount.Direct_Contact_Prohibited__c = TRUE;