USP_SIMPLEDATALIST_BUSINESSPROCESSCOMMPREFSOLICITCODE

Returns a list of solicit codes that implements site security and includes all sites.

Parameters

Parameter Parameter Type Mode Description
@CURRENTAPPUSERID uniqueidentifier IN Input parameter indicating the ID of the current user.
@OWNERID uniqueidentifier IN Owner ID

Definition

Copy


                CREATE procedure dbo.USP_SIMPLEDATALIST_BUSINESSPROCESSCOMMPREFSOLICITCODE
                (
                    @CURRENTAPPUSERID uniqueidentifier,
                    @OWNERID uniqueidentifier = null
                )
                as
                    set nocount on;

                    select 
                        SOLICITCODE.ID as VALUE
                        case when SOLICITCODE.SITEID is null then SOLICITCODE.DESCRIPTION else SOLICITCODE.DESCRIPTION + ' - ' + SITE.NAME END as LABEL
                    from 
                        dbo.SOLICITCODE
                    left join dbo.SITE on SOLICITCODE.SITEID = SITE.ID
                    where (SOLICITCODE.SITEID in (select SITEID from dbo.UFN_SITESFORUSER(@CURRENTAPPUSERID)) and @OWNERID is null)
                        or (SOLICITCODE.SITEID in (select SITEID from dbo.UFN_SITESFORUSER(@OWNERID)))
                        or SOLICITCODE.SITEID is null
                        and SOLICITCODE.ACTIVE = 1
                    order by SOLICITCODE.DESCRIPTION;