function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Viasur-Viasur- 

Trigger not launching ???

Hello all,

 

Can anyone let me know what is making this simple trigger not to firing?

 

trigger DeleteContact on Contact (before delete){
     for(Contact c : Trigger.old){ 
     
       String profileId = UserInfo.getProfileId();
      
       if(c.AccountId!=null && (profileId!='00e11000000Df7mAAC') && (profileId!='00e11000000Df8aAAC') && (profileId!='00eb0000000rNRWAA2')){
                c.addError('You don\'t have sufficient rights to delete this record!');
                
                }
        }
 }

 Thanks in advanced!!

Deepa.B.AnkaliDeepa.B.Ankali
@Viasur-,

Just to confirm, hope your trigger is active!!
Viasur-Viasur-

Hey ... yes it is :)

ssfdcssfdc

How did you check if the Trigger is firing or not?, don't depend on the Error message to show up, I would first insert a debug statment in the trigger and check this in the Dev console after delteing a contact, I would also make sure the Contact is actually getting deleted and making sure nothing is blocking the trigger from firing - i.e workflow rule.

 

for(Contact c : Trigger.old){ 
System.debug('Trigger fired');