USP_MKTSPONSORSHIPMAILINGTEMPLATE_DELETE

Executes the "Sponsorship Template: 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_MKTSPONSORSHIPMAILINGTEMPLATE_DELETE]
(
  @ID uniqueidentifier,
  @CHANGEAGENTID uniqueidentifier
)
as
  set nocount on;

  declare @PARAMETERSETID uniqueidentifier;

  begin try
    select
      @PARAMETERSETID = [ID]
    from dbo.[MKTSPONSORSHIPMAILINGPROCESS]
    where [SPONSORSHIPMAILINGTEMPLATEID] = @ID;

    /* Clean up the comm prefs related to activation */
    exec dbo.[USP_BUSINESSPROCESSCOMMPREF_DELETE] '22C3D75C-A956-4BFC-A5FD-4B866BAEF509', @PARAMETERSETID, @CHANGEAGENTID;

    exec dbo.[USP_BUSINESSPROCESS_PARAMETERSETCANBEDELETED] 'MKTSPONSORSHIPMAILINGPROCESSSTATUS', @PARAMETERSETID;

    exec dbo.[USP_BUSINESSPROCESSINSTANCE_DELETE] 'b043b938-9cbe-4c3d-81e3-e3f59e0e56dc', @PARAMETERSETID, @CHANGEAGENTID;

    delete from dbo.MKTSPONSORSHIPMAILINGTEMPLATEACTIVATED where MKTSPONSORSHIPMAILINGTEMPLATEID = @ID

    exec dbo.[USP_MKTSPONSORSHIPMAILINGTEMPLATE_DELETEBYID_WITHCHANGEAGENTID] @ID, @CHANGEAGENTID;
  end try

  begin catch
    exec dbo.[USP_RAISE_ERROR];
    return 1;
  end catch

  return 0;