USP_SIMPLEDATALIST_STEWARDSHIPPLANSTEPCONTACTPEOPLE
List of the available contact people for a step added to the stewardship plan of a household/group/organization.
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@PLANID | uniqueidentifier | IN | PLANID |
@CURRENTAPPUSERID | uniqueidentifier | IN | Input parameter indicating the ID of the current user. |
@DATAFORMINSTANCEID | uniqueidentifier | IN | DATAFORMINSTANCEID |
@INCLUDEGROUPORORG | bit | IN | INCLUDEGROUPORORG |
@CONSTITUENTID | uniqueidentifier | IN |
Definition
Copy
CREATE procedure dbo.USP_SIMPLEDATALIST_STEWARDSHIPPLANSTEPCONTACTPEOPLE
(
@PLANID uniqueidentifier = null,
--@CURRENTCONTACTPERSONID uniqueidentifier = null,
@CURRENTAPPUSERID uniqueidentifier = null,
@DATAFORMINSTANCEID uniqueidentifier = null,
@INCLUDEGROUPORORG bit = 1,
@CONSTITUENTID uniqueidentifier = null
)
as
set nocount on;
declare @CURRENTDATE datetime;
set @CURRENTDATE = dbo.UFN_DATE_GETEARLIESTTIME(getdate());
declare @ISGROUP bit;
declare @ISORG bit;
if @CONSTITUENTID is null
begin
select
@CONSTITUENTID = CONSTITUENT.ID,
@ISGROUP = CONSTITUENT.ISGROUP,
@ISORG = CONSTITUENT.ISORGANIZATION
from
dbo.STEWARDSHIPPLAN [PLAN]
inner join dbo.CONSTITUENT
on [PLAN].CONSTITUENTID = CONSTITUENT.ID
where
[PLAN].ID = @PLANID;
end
else
begin
select
@ISGROUP = CONSTITUENT.ISGROUP,
@ISORG = CONSTITUENT.ISORGANIZATION
from
dbo.CONSTITUENT
where @CONSTITUENTID = CONSTITUENT.ID
end
if @ISGROUP = 1
select
ID as VALUE,
NAME as LABEL
from dbo.UFN_GROUP_GETCURRENTMEMBERS(@CONSTITUENTID, @CURRENTAPPUSERID, @DATAFORMINSTANCEID, @INCLUDEGROUPORORG)
order by NAME
else
select
ID as VALUE,
NAME as LABEL
from dbo.UFN_ORGANIZATION_GETCURRENTCONTACTS(@CONSTITUENTID, @CURRENTAPPUSERID, @DATAFORMINSTANCEID, @INCLUDEGROUPORORG)
order by NAME