sp_On_Fax_Status is triggered upon receiving progress notification from fax server for a fax job.


This procedure should not be called directly by developer, it is automatically called by Boomerang services each time it receives notifications from fax server upon a job progress. This handler is invoked by Boomerang services both in event of success and failure.

Default body of this procedure is blank, thus you 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]


exec sp_On_Fax_Status @jKey=..., @status=... , @msg=...


Column Name Data type Direction Description Default Status
@jKey uniqueidentifier in Job key jKey found in OUT_FAX table Required
@status int in Status (0 = success, 1 = failure) Required
@msg varchar(500) in Message from fax server Required

Return Code Values

0 (success) or non-zero (failure)


Forward failure events from fax jobs by e-mail.

ALTER procedure dbo.sp_On_Fax_Status
  @jKey uniqueidentifier,
  @status int,
  @msg varchar(500)
as begin
  set nocount on
  declare @gKey uniqueidentifier;
  declare @jKeyTo uniqueidentifier;
  declare @admin varchar(50); set @admin = 'joe.doe@fuel9.com'
  declare @svc_account varchar(50); set @svc_account = 'FUEL9\us_box_prrs'
  declare @usr varchar(100),
          @src int,
          @k1 varchar(255),
          @k2 varchar(255),
          @dt datetime,
          @fax varchar(255),
          @email varchar(255),
          @tpt varbinary(16),
          @line varchar(4000);
  -- forward delivery errors
  IF( @status=1 ) BEGIN
    select  @src	= g.Source,
            @usr	= g.Created_By, 
            @k1		= g.Str1, 
            @k2		= g.Str2, 
            @dt		= g.Created_On, 
            @fax	= j.Receiver_Fax_Number
    from OUT_FAX j
           left join 
         EVENT_MASTER g on g.gKey=j.gKey
    where j.jKey=@jKey
    -- Customer Services Event
    if( @src = 40 ) begin
      -- get originator e-mail
      select top 1 @email=case when Logon=@svc_account then @admin else [e-mail] end from IS_DB..Contacts where Logon=@usr
      if( @@rowcount > 0 and not @email is null ) begin
        select @gKey = newid(), @jKeyTo = newid()
        insert EVENT_MASTER (gKey, Created_By, Source, Str1, Str2, Int1) values (@gKey, @svc_account, @src, @k1, @k2, 0)
        insert OUT_EMAIL (gKey,jKey,Subject,Body,IncludeKey) values (@gKey,@jKeyTo,'Fax delivery failure','',0)
        select @tpt=textptr(Body) from OUT_EMAIL where jKey=@jKeyTo
        set @line=@msg+char(13)+char(10)+char(13)+char(10)
        updatetext OUT_EMAIL.Body @tpt null 0 @line
        set @line='Fax number: '+@fax+char(13)+char(10)+char(13)+char(10)
        updatetext OUT_EMAIL.Body @tpt null 0 @line
        set @line='To check status follow link: https://apps.fuel9.com/boom/EVENTS/LIST.aspx?s_src=40&s_Str1='+@k1+char(13)+char(10)+char(13)+char(10)
        updatetext OUT_EMAIL.Body @tpt null 0 @line
        if( @k1 like '_002%' ) 
          set @line='To edit order follow link: https://apps.fuel9.com/boom/chairs/quote.aspx?Tab=4&oKey='+@k1
          set @line='To edit order follow link: https://apps.fuel9.com/boom/parts/quote.aspx?Tab=4&oKey='+@k1
        updatetext OUT_EMAIL.Body @tpt null 0 @line
        insert OUT_EMAIL_RECIPIENT (jKey,Email,Type) values (@jKeyTo,@email,1)
        update EVENT_MASTER set Status=0 where gKey=@gKey
  return 0

See Also 

Database Tables
Getting Started