USP_CAMPAIGNFUNDRAISER_DELETE
Executes the "Campaign Fundraiser: 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_CAMPAIGNFUNDRAISER_DELETE (
@ID uniqueidentifier,
@CHANGEAGENTID uniqueidentifier
) as begin
set nocount on;
--check for existing related KPIs
declare @KPIS integer;
WITH XMLNAMESPACES (
'bb_appfx_dataforms' AS DFI)
select @KPIS = count(*)
from dbo.KPIINSTANCE
inner join dbo.CAMPAIGNFUNDRAISER on
KPIINSTANCE.PARAMETERSXML.value('data(/DFI:DataFormItem/DFI:Values/DFI:fv[@ID="CAMPAIGNID"]/DFI:Value)[1]','varchar(36)') = cast(CAMPAIGNFUNDRAISER.CAMPAIGNID as nvarchar(36)) and
KPIINSTANCE.PARAMETERSXML.value('data(/DFI:DataFormItem/DFI:Values/DFI:fv[@ID="FUNDRAISERID"]/DFI:Value)[1]','varchar(36)') = cast(CAMPAIGNFUNDRAISER.CONSTITUENTID as varchar(36))
where CAMPAIGNFUNDRAISER.ID = @ID
if @KPIS > 0
begin
raiserror('This fundraiser has an associated KPI and cannot be deleted.', 13, 1);
return 0;
end
exec dbo.USP_CAMPAIGNFUNDRAISER_DELETEBYID_WITHCHANGEAGENTID @ID, @CHANGEAGENTID;
end