USP_DATAFORMTEMPLATE_EDIT_PROSPECTRESEARCHREQUESTCONSTITUENTREJECT
The save procedure used by the edit dataform template "Prospect Research Request Constituent Reject Edit Form".
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. |
@PROSPECTRESEARCHREQUESTSTATUSCHANGECODEID | uniqueidentifier | IN | Reason |
@STATUSCHANGENOTES | nvarchar(max) | IN | Comments |
@STATUSCODE | tinyint | IN | Status |
@CURRENTAPPUSERID | uniqueidentifier | IN | Input parameter indicating the ID of the current user. |
Definition
Copy
CREATE procedure dbo.USP_DATAFORMTEMPLATE_EDIT_PROSPECTRESEARCHREQUESTCONSTITUENTREJECT (
@ID uniqueidentifier,
@CHANGEAGENTID uniqueidentifier = null,
@PROSPECTRESEARCHREQUESTSTATUSCHANGECODEID uniqueidentifier,
@STATUSCHANGENOTES nvarchar(max),
@STATUSCODE tinyint,
@CURRENTAPPUSERID uniqueidentifier
)
as
set nocount on;
if @CHANGEAGENTID is null
exec dbo.USP_CHANGEAGENT_GETORCREATECHANGEAGENT @CHANGEAGENTID output
declare @CURRENTDATE datetime
set @CURRENTDATE = getdate()
begin try
-- handle updating the data
if @STATUSCODE not in (1, 2) begin
raiserror('BBERR_PROSPECTRESEARCHREQUEST_BADREJECTSTATE', 13, 1);
return 1;
end
update dbo.PROSPECTRESEARCHREQUESTCONSTITUENT set
STATUSCODE = 5,
PROSPECTRESEARCHREQUESTSTATUSCHANGECODEID = @PROSPECTRESEARCHREQUESTSTATUSCHANGECODEID,
STATUSCHANGENOTES = @STATUSCHANGENOTES,
CHANGEDBYID = @CHANGEAGENTID,
DATECHANGED = @CURRENTDATE
where ID = @ID
exec dbo.USP_PROSPECTRESEARCHREQUESTCONSTITUENT_CANCELEDREJECTEDALERT_SEND @CURRENTAPPUSERID, @ID;
end try
begin catch
exec dbo.USP_RAISE_ERROR
return 1
end catch
return 0;