sp_After_Email_Job

sp_After_Email_Job

sp_After_Email_Job is triggered upon completion of an e-mail job.

Remarks

This procedure should not be called directly by developer, it is automatically called by Boomerang services after completion of a job. This handler is invoked by Boomerang services both in event of success and failure.

Default body of this procedure is blank, thus user may provide their own code implementation for follow-up purposes.

[important]Any changes to handler parameter list cannot be made. New parameters may add with future Boomerang releases upon which a notice will be sent separately.[/important]

Syntax

exec sp_After_Email_Job @jKey=..., @lKey=... , @error_level=...

Parameters

Column Name Data type Direction Description Default Status
@jKey uniqueidentifier in Job key jKey found in OUT_EMAIL table Required
@lKey uniqueidentifier in Log entry key lKey found in EVENT_LOG table Required
@error_level int in Error status (0 = success, 1 = business, 2 = system) Required

 

Return Code Values

0 (success) or non-zero (failure)

Examples

Tag customer order shipment confirmation as “sent”.

-------Sample--------
/*******************************************************************
  08-11-14 [DPA] - new object; User event
  09-03-31 [DPA] - process shipment confirmations, PD# 18478
*******************************************************************/
ALTER procedure dbo.sp_After_Email_Job
(
  @jKey uniqueidentifier ,
  @lKey uniqueidentifier ,
  @error_level int 
)
as begin
  set nocount on
  declare @src int, @int1 int
  declare @ordNo varchar(100), @Cust varchar(100)
 
  if( @error_level!=0 ) return		/* do nothing on errors */
 
  select top 1				/* get job details */
    @src 	= Source,
    @ordNo	= Str1,
    @Cust	= Str2,
    @int1	= Int1
  from OUT_EMAIL j with(nolock)
         inner join 
       EVENT_MASTER g with(nolock) on g.gKey=j.gKey
  where jKey=@jKey
 
  if( @src=40 and @int1=10 ) begin	/* was this a shipment confirmation job? */
    if( @ordNo like '_002%' )
      exec erpDB.dbo.sp_update_shp_flags @ordNo, @Cust, 'Type-A', ''
    else
      exec erpDB.dbo.sp_update_shp_flags @ordNo, @Cust, 'Type-B', ''
  end
 
end

See Also

Helpers
Database Tables
Getting Started