USP_BBWORKFLOW_BUSINESSACTIVITY_END
Updates the Workflow Business Activity record when the activity completes.
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@ID | uniqueidentifier | IN | |
@CHANGEAGENTID | uniqueidentifier | IN | |
@ACTIVITYENDDATE | datetimeoffset | IN | |
@ENDMESSAGE | nvarchar(max) | IN |
Definition
Copy
create procedure dbo.USP_BBWORKFLOW_BUSINESSACTIVITY_END
@ID uniqueidentifier,
@CHANGEAGENTID uniqueidentifier = null,
@ACTIVITYENDDATE datetimeoffset ,
@ENDMESSAGE nvarchar(max)
/*
Updates the Workflow Business Activity record when the activity completes.
*/
as
set nocount on;
if @CHANGEAGENTID is null
exec dbo.USP_CHANGEAGENT_GETORCREATECHANGEAGENT @CHANGEAGENTID output;
begin try
update dbo.BBWORKFLOWBUSINESSACTIVITY
set
ACTIVITYENDDATE=@ACTIVITYENDDATE,
ENDMESSAGE=@ENDMESSAGE
where ID= @ID;
--add a row to the workflow log table.
declare @DISPLAYNAME nvarchar(255);
declare @BBWORKFLOWINSTANCEINFOID uniqueidentifier;
select @DISPLAYNAME=DISPLAYNAME,@BBWORKFLOWINSTANCEINFOID=BBWORKFLOWINSTANCEINFOID from dbo.BBWORKFLOWBUSINESSACTIVITY where ID=@ID;
if @BBWORKFLOWINSTANCEINFOID is not null
BEGIN
if @DISPLAYNAME is null set @DISPLAYNAME=N'unknown display name';
declare @LOGID uniqueidentifier=NEWID();
declare @MSG nvarchar(max);
set @MSG = N'biz activity ended: ' + @DISPLAYNAME;
exec dbo.USP_BBWORKFLOW_ADD_LOG_MESSAGE @LOGID, @CHANGEAGENTID, @BBWORKFLOWINSTANCEINFOID, 0, @MSG, 1;
END
end try
begin catch
exec dbo.USP_RAISE_ERROR;
return 1;
end catch
return 0;