trigger contacttrigger on contact (before delete) {
for (customobject__C coj : [SELECT Contactlookup__c
FROM contactrelatedobject__c
WHERE Contactlookup__c
IN :Trigger.oldMap.keySet()]) {
Trigger.oldMap.get(coj.contactlookup__c).addError(
'Cannot delete contact with a contactrelatedobject record');
}
}
No comments:
Post a Comment