USP_SIMPLEDATALIST_PROSPECTPLANSITES

List of all sites in the system that a given user could interact with (based on Role assignments) and any sites assigned to the prospect plan that the user does not otherwise have access.

Parameters

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

Definition

Copy


                CREATE procedure dbo.USP_SIMPLEDATALIST_PROSPECTPLANSITES(
                    @CURRENTAPPUSERID uniqueidentifier,
                    @PROSPECTPLANID uniqueidentifier
                )                            
                as                

                    set nocount on;

                    select 
                        SFU.[SITEID] as VALUE
                        SITE.[NAME] as LABEL 
                    from 
                        dbo.SITE inner join dbo.UFN_SITESFORUSER(@CURRENTAPPUSERID) AS SFU
                        ON SFU.SITEID=SITE.ID
                    union
                    select
                        PROSPECTPLANSITE.SITEID as VALUE,
                        SITE.NAME as LABEL
                    from
                        dbo.PROSPECTPLANSITE
                        inner join dbo.SITE on SITE.ID = PROSPECTPLANSITE.SITEID
                    where
                        PROSPECTPLANSITE.PROSPECTPLANID = @PROSPECTPLANID
                    order by
                        LABEL;