+ Start a Discussion

Supressing Case Assignment Emails (in trigger)



We have a new business rule in place that says that whoever closes a case should become the owner of that case if he isn't already.  If there are cases in a queue that are the result of spam for instance, a rep can simply close it rather than taking ownership first, then closing it.  I accomplish this using an update trigger on Case.


The only trouble is that when this trigger fires, an email also fires to the rep letting him know that he's been assigned a case.  He already knows ... he's basically assigned the case to himself.  So now reps get loads of email every time they do this.


In the Setup under Support Settings, the checkbox for "Use this setting to automatically select the Send Notification Email checkbox on cases when users change a case owner to another user" is unchecked.  The option for Case Assigned Template is blank.


Is there anything I should be putting in the trigger to supress the assignment email?


The trigger:

trigger updateCloseCase on Case (before update) { for (Integer i = 0; i < Trigger.new.size(); i++) { if (Trigger.new[i].Status == 'Closed' && Trigger.old[i].Status != 'Closed')


{ Trigger.new[i].OwnerId = UserInfo.getUserId() ; } } }


The funny thing is that I also have a button on cases called "Take Ownership" which allows a user to quickly change case ownership to himself and that doesn't cause any email to fire, but the trigger above does.


Can anyone shed some light on this?


Has anyone come up with a solution on this?  I'm seeing a similar problem except it is occurring to a DBA account that is used to create cases and handle different things, and it is looping back into our e-mail system because of it.