USP_DATAFORMTEMPLATE_EDIT_STEP_2
The save procedure used by the edit dataform template "Step Edit Form 2".
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@ID | uniqueidentifier | IN | The input ID parameter indicating the ID of the record being edited. |
@CHANGEAGENTID | uniqueidentifier | IN | Input parameter indicating the ID of the change agent invoking the procedure. |
@EXPECTEDDATE | datetime | IN | Expected date |
@ACTUALDATE | datetime | IN | Actual date |
@STATUSCODE | tinyint | IN | Status |
@OWNERID | uniqueidentifier | IN | Owner |
@INTERACTIONTYPECODEID | uniqueidentifier | IN | Contact method |
@OBJECTIVE | nvarchar(100) | IN | Objective |
@PROSPECTPLANSTATUSCODEID | uniqueidentifier | IN | Stage |
@COMMENT | nvarchar(max) | IN | Comment |
@ADDITIONALFUNDRAISERS | xml | IN | Additional fundraisers |
Definition
Copy
CREATE procedure dbo.USP_DATAFORMTEMPLATE_EDIT_STEP_2
(
@ID uniqueidentifier,
@CHANGEAGENTID uniqueidentifier = null,
@EXPECTEDDATE datetime,
@ACTUALDATE datetime,
@STATUSCODE tinyint,
@OWNERID uniqueidentifier,
@INTERACTIONTYPECODEID uniqueidentifier,
@OBJECTIVE nvarchar(100),
@PROSPECTPLANSTATUSCODEID uniqueidentifier,
@COMMENT nvarchar(max),
@ADDITIONALFUNDRAISERS xml
) as begin
set nocount on;
if @CHANGEAGENTID is null
exec dbo.USP_CHANGEAGENT_GETORCREATECHANGEAGENT @CHANGEAGENTID output
begin try
-- Clear the owner from additional fundraisers in case the new owner was an additional fundraiser
-- but isn't anymore. If they weren't cleared, a constraint violation would occur. If the owner
-- is still an additional fundraiser, it will be caught when updating the additional fundraisers.
delete from dbo.INTERACTIONADDITIONALFUNDRAISER where INTERACTIONID = @ID and FUNDRAISERID = @OWNERID;
update dbo.INTERACTION set
CHANGEDBYID = @CHANGEAGENTID,
DATECHANGED = getdate(),
EXPECTEDDATE = @EXPECTEDDATE,
ACTUALDATE = @ACTUALDATE,
FUNDRAISERID = @OWNERID,
INTERACTIONTYPECODEID = @INTERACTIONTYPECODEID,
OBJECTIVE = @OBJECTIVE,
STATUSCODE = @STATUSCODE,
COMMENT = @COMMENT,
PROSPECTPLANSTATUSCODEID = @PROSPECTPLANSTATUSCODEID
where
ID = @ID
exec dbo.USP_INTERACTION_ADDITIONALFUNDRAISERS_UPDATEFROMXML @ID, @ADDITIONALFUNDRAISERS, @CHANGEAGENTID;
end try
begin catch
exec dbo.USP_RAISE_ERROR;
return 1;
end catch;
return 0;
end