USP_PROSPECTASSIGNMENTREQUEST_DENY

Executes the "Deny 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_DENY
(
    @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

  update dbo.PROSPECTPLANREQUEST set 
        STATUSCODE = 2,
        REVIEWDATE = @CHANGEDATE,
        REVIEWEDBYID = @CURRENTAPPUSERID,
        DATECHANGED = @CHANGEDATE,
        CHANGEDBYID = @CHANGEAGENTID
    where ID = @ID;

  end
  else -- Prospect Assignment Request

  begin

    update dbo.PROSPECTASSIGNMENTREQUEST set 
        STATUSCODE = 2,
        REVIEWDATE = @CHANGEDATE,
        REVIEWEDBYID = @CURRENTAPPUSERID,
        DATECHANGED = @CHANGEDATE,
        CHANGEDBYID = @CHANGEAGENTID
    where ID = @ID;

  end

    return 0;

end