USP_WORKFLOW_TASK_MARK_COMPLETED

Executes the "Workflow Task: Mark Complete" 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_WORKFLOW_TASK_MARK_COMPLETED

    @ID uniqueidentifier,
  @CURRENTAPPUSERID uniqueidentifier,
    @CHANGEAGENTID uniqueidentifier = null

as

  declare @USERCANMARKCOMPLETE bit;
  select @USERCANMARKCOMPLETE=USERCANCOMPLETE from dbo.BBWORKFLOWTASK where ID = @ID;

  if @USERCANMARKCOMPLETE = 0
  BEGIN
    RAISERROR('This task cannot be marked complete by an end user.',16,10);
    return 500;
  END

  if @CHANGEAGENTID is null  
      exec dbo.USP_CHANGEAGENT_GETORCREATECHANGEAGENT @CHANGEAGENTID output;

  declare @r int;

  exec @r=dbo.USP_BBWORKFLOW_SERVICE_SENDMESSAGE_TASKCOMPLETED @ID, @CURRENTAPPUSERID, @CHANGEAGENTID;

  return @r;