USP_PROSPECTASSIGNMENTREQUEST_CANCEL
Executes the "Cancel Prospect Request" record operation.
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@ID | uniqueidentifier | IN | Input parameter indicating the ID of the record being updated. |
@CURRENTAPPUSERID | uniqueidentifier | IN | Input parameter indicating the ID of the current user. |
@CHANGEAGENTID | uniqueidentifier | IN | Input parameter indicating the ID of the change agent invoking the update. |
Definition
Copy
CREATE procedure dbo.USP_PROSPECTASSIGNMENTREQUEST_CANCEL
(
@ID uniqueidentifier,
@CURRENTAPPUSERID uniqueidentifier,
@CHANGEAGENTID uniqueidentifier
)
as begin
if @CHANGEAGENTID is null
exec dbo.USP_CHANGEAGENT_GETORCREATECHANGEAGENT @CHANGEAGENTID output;
declare @CHANGEDATE datetime;
set @CHANGEDATE = getdate();
if exists(select 1 from dbo.PROSPECTPLANREQUEST where ID = @ID) -- Prospect Plan Request
begin
delete from dbo.PROSPECTPLANREQUEST
where ID = @ID;
end
else -- Prospect Assignment Request
begin
update dbo.PROSPECTASSIGNMENTREQUEST set
STATUSCODE = 3,
REVIEWDATE = @CHANGEDATE,
REVIEWEDBYID = @CURRENTAPPUSERID,
DATECHANGED = @CHANGEDATE,
CHANGEDBYID = @CHANGEAGENTID
where ID = @ID;
end
return 0;
end