USP_PLEDGEREMINDERPROCESSSTATUS_DELETE
Executes the "Pledge Reminder Process Status: 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_PLEDGEREMINDERPROCESSSTATUS_DELETE
(
@ID uniqueidentifier,
@CHANGEAGENTID uniqueidentifier
)
as
set nocount on;
if exists (select ID from dbo.BUSINESSPROCESSSTATUS where ID = @ID and STATUSCODE = 1)
raiserror('Business process is still running',13,1);
-- if records have not been marked sent for this run, delete the records from the PLEDGEREMINDERSENT table
--Cache CONTEXT INFO
declare @contextCache varbinary(128);
set @contextCache = CONTEXT_INFO();
if not @CHANGEAGENTID is null
set CONTEXT_INFO @CHANGEAGENTID;
delete from dbo.PLEDGEREMINDERSENT where PLEDGEREMINDERPROCESSSTATUSID = @ID and SENTDATE is null;
--Restore CONTEXT_INFO
if not @contextCache is null
set CONTEXT_INFO @contextCache;
exec dbo.USP_BUSINESSPROCESSSTATUS_DELETEBYID_WITHCHANGEAGENTID @ID, @CHANGEAGENTID
return 0;