title: Microsoft CRM 4.0 shows error after adding trigger with email alert on IncidentBase table (Cases) in SQL
body: <p>I have been trying to find a solution on this problem for hours with no luck. Let me explain the situation.</p>
  <p>There is a Microsoft CRM 4.0 server that we need to add an email alert whenever a user cancels a case. There are 2 possible ways to do that, first is through the &quot;OnSave&quot; event on the Case Form through the Customizations menu (which we have access to) and second by adding a trigger directly on the MS SQL DB of the CRM app that will fire anytime a user does exactly what the trigger says.</p>
  <p>So I went with the second option and while I created the trigger, set the Database Mail (which works perfect) and tested the trigger by manually updating the table contents through the SQL Management Studio (the email alert worked like a charm), when I try to cancel the case through the CRM form, I get a generic error page from CRM like the one following and it doesn't complete the cancellation.</p>
  <p><a href="https://i.stack.imgur.com/nsOgb.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nsOgb.png" alt="enter image description here" /></a></p>
  <p>If I disable the trigger, everything works fine again. Also, if I change the trigger script and only the part of the email send (EXEC msdb.dbo.sp_send_dbmail) with something else generic like inserting a row in another table, CRM works like it should and it finishes the cancellation of the case. It's obvious that there is something in the email sending that messes things up with the CRM.</p>
  <p>I just hope that there is somebody in the community that have worked with MS CRM 4.0 in the past and can give me some advice. I don't mind using the first method also through the Event Customization if someone can give me some pointers. I believe Javascript is used for scripting in this environment but I think that setting an email alert there is way out of the scope of this environment. Let's hope I am wrong...</p>
  <p>Thanx in advance.</p>