USP_SIMPLEACKNOWLEDGEMENTHISTORY_CLEARLETTERHISTORY

Executes the "Acknowledgement Letter History: Delete" record operation.

Parameters

Parameter Parameter Type Mode Description
@ID uniqueidentifier IN Input parameter indicating the ID of the record being deleted.
@CHANGEAGENTID uniqueidentifier IN Input parameter indicating the ID of the change agent invoking the delete.

Definition

Copy


CREATE procedure dbo.USP_SIMPLEACKNOWLEDGEMENTHISTORY_CLEARLETTERHISTORY
(
    @ID uniqueidentifier,
    @CHANGEAGENTID uniqueidentifier
)
as begin

  declare @contextCache varbinary(128);

  if @CHANGEAGENTID is null
      exec dbo.[USP_CHANGEAGENT_GETORCREATECHANGEAGENT] @CHANGEAGENTID output;

    /* cache current context information */
    set @contextCache = CONTEXT_INFO();

    /* set CONTEXT_INFO to @CHANGEAGENTID */    
    set CONTEXT_INFO @CHANGEAGENTID

  delete from dbo.REVENUELETTER where MKTSEGMENTATIONACTIVATEPROCESSSTATUSID = @ID;

  /* reset CONTEXT_INFO to previous value */
    if not @contextCache is null
        set CONTEXT_INFO @contextCache

  update 
        dbo.BUSINESSPROCESSSTATUS 
    set 
        STATUSCODE = 3,
        CHANGEDBYID = @CHANGEAGENTID,
        DATECHANGED = getdate()
    where 
        ID = @ID;

    return 0;    
end