UFN_BBWORKFLOW_SERVICE_BUILDMESSAGE_STARTWORKFLOW

Returns an xml StartWorkflowRequest message for use with the workflow service queue.

Return

Return Type
xml

Parameters

Parameter Parameter Type Mode Description
@BBWORKFLOWINSTANCEINFOID uniqueidentifier IN
@CHANGEAGENTID uniqueidentifier IN
@CURRENTAPPUSERID uniqueidentifier IN

Definition

Copy


create function dbo.UFN_BBWORKFLOW_SERVICE_BUILDMESSAGE_STARTWORKFLOW(@BBWORKFLOWINSTANCEINFOID uniqueidentifier, @CHANGEAGENTID uniqueidentifier, @CURRENTAPPUSERID uniqueidentifier)
returns xml
as

begin

    declare @id nvarchar(38);
    set @id=cast(@BBWORKFLOWINSTANCEINFOID as nvarchar(38));

  declare @catalogId nvarchar(38);
  select @catalogId=BBWORKFLOWCATALOGID from dbo.BBWORKFLOWINSTANCEINFO WHERE ID=@BBWORKFLOWINSTANCEINFOID;

  if @catalogId is null set @catalogId = '00000000-0000-0000-0000-000000000000';
  if @CURRENTAPPUSERID is null set @CURRENTAPPUSERID='00000000-0000-0000-0000-000000000000';
  if @CHANGEAGENTID is null set @CHANGEAGENTID='00000000-0000-0000-0000-000000000000';

    declare @msg nvarchar(1024);
    set @msg=
N'<StartWorkflowRequest xmlns="urn:blackbaud-workflow-contracts">
    <WorkflowInstanceRecordID>' + @id + N'</WorkflowInstanceRecordID>
  <WorkflowSpecCatalogID>' + @catalogId + N'</WorkflowSpecCatalogID>
  <ChangeAgentId>' + cast(@CHANGEAGENTID as nvarchar(38)) + N'</ChangeAgentId>
  <CurrentAppUserID>' + cast(@CURRENTAPPUSERID as nvarchar(38)) + N'</CurrentAppUserID>
</StartWorkflowRequest>';

    declare @xml xml ;
    set @xml = CONVERT( xml, @msg, 1);

    return @xml;


end