UFN_BUILDSTEPFUNDRAISERNAMEWITHROLE
Returns a string holding the fundraiser along with their role(s) in parentheses.
Return
Return Type |
---|
nvarchar(max) |
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@INTERACTIONID | uniqueidentifier | IN | |
@CONSTITUENTID | uniqueidentifier | IN |
Definition
Copy
CREATE function dbo.UFN_BUILDSTEPFUNDRAISERNAMEWITHROLE
(
@INTERACTIONID uniqueidentifier,
@CONSTITUENTID uniqueidentifier
)
returns nvarchar(max)
with execute as caller
as begin
declare @PROSPECTPLANID uniqueidentifier;
select @PROSPECTPLANID = PROSPECTPLANID from dbo.INTERACTION where ID = @INTERACTIONID;
declare @OUTPUT nvarchar(max);
select @OUTPUT = NF.NAME
from dbo.UFN_CONSTITUENT_DISPLAYNAME(@CONSTITUENTID) NF;
select
@OUTPUT = @OUTPUT + ' (' + dbo.UDA_BUILDLIST(FUNDRAISERROLE) + ')'
from
dbo.UFN_PROSPECTPLAN_FUNDRAISERS(@PROSPECTPLANID)
where
ID = @CONSTITUENTID;
-- Remove the parentheses if they are empty
if substring(@OUTPUT, len(@OUTPUT)-1, 2) = '()'
select @OUTPUT = substring(@OUTPUT, 0, len(@OUTPUT) - 2)
return @OUTPUT;
end