UFN_FUNDRAISER_GETDEFAULTSITEID
Fetches the ID of the default site (if any) for a fundraiser.
Return
Return Type |
---|
uniqueidentifier |
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@CONSTITUENTID | uniqueidentifier | IN |
Definition
Copy
create function dbo.UFN_FUNDRAISER_GETDEFAULTSITEID
(
@CONSTITUENTID uniqueidentifier
)
returns uniqueidentifier
with execute as caller
as begin
declare @siteId uniqueidentifier
declare @currentDate date = dbo.UFN_DATE_GETEARLIESTTIME(getdate())
select @siteId = SITEID
from dbo.ORGANIZATIONPOSITIONHOLDER holder
join dbo.ORGANIZATIONPOSITION pos on holder.POSITIONID = pos.ID
where CONSTITUENTID = @CONSTITUENTID
and DATEFROM <= @currentDate
and (DATETO is null OR DATETO >= @currentDate)
return @siteId
end