A customer asked me to add this feature to his Contact management application based on SQL server 2008.
As soon as a new lead is added to the database and a representative is assigned to him or her, send an email to the representative with the contact data from the lead
This can be done from within the SQL server without any external coding required.
- With an insert trigger the action can be started.
- Insertion of new leads should be fast and stable, so I decided not to send the email immediately but to store the email data in a history table. The added benefit for my customer is that he can have a list of these messages to follow up with his representatives.
- The insert trigger on the leads table inserts a new record in the history table.
- A stored procedure is made to read new records in the history table and mail a message to the representative.
- The stored procedure uses sp_send_dbmail.
No comments:
Post a Comment