UFN_APPUSER_HASBUSINESSPROCESSTASK

Returns true if the given user has been assigned a RunBusinessProcess task that uses the given parameter set.

Return

Return Type
bit

Parameters

Parameter Parameter Type Mode Description
@APPUSERID uniqueidentifier IN
@PARAMETERSETID uniqueidentifier IN

Definition

Copy


/*
Returns true if the given user has been assigned a RunBusinessProcess task that uses the given parameter set.
*/
create function dbo.UFN_APPUSER_HASBUSINESSPROCESSTASK
    (
        @APPUSERID uniqueidentifier,
        @PARAMETERSETID uniqueidentifier
    )
    returns bit
as
    begin
        declare @TASKID uniqueidentifier

        set @TASKID = (
            select 
                top 1 TASKCATALOG.ID
            from dbo.TASKCATALOG 
                inner join dbo.SYSTEMROLETASK on TASKCATALOG.ID = SYSTEMROLETASK.TASKID
                inner join dbo.SYSTEMROLEAPPUSER on SYSTEMROLEAPPUSER.SYSTEMROLEID = SYSTEMROLETASK.SYSTEMROLEID
            where 
                (dbo.SYSTEMROLEAPPUSER.APPUSERID = @APPUSERID) and
                TASKSPECXML.value('declare namespace bbtask="bb_appfx_task";
                                   declare namespace common="bb_appfx_commontypes";
                                   (bbtask:TaskSpec/common:RunBusinessProcess/@BusinessProcessParameterSetID)[1]','uniqueidentifier') = @PARAMETERSETID)

        if @TASKID is not null
            return 1

        return 0

    end