UFN_FAFINCENTIVEBENEFIT_COMMUNICATIONS
Return
Return Type |
---|
int |
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@REGISTRANTID | uniqueidentifier | IN |
Definition
Copy
CREATE function dbo.UFN_FAFINCENTIVEBENEFIT_COMMUNICATIONS(@REGISTRANTID uniqueidentifier)
returns int
with execute as caller
as begin
declare @totalCount int,
@emailCount int,
@socialNetworkPostCount int,
@constituentID uniqueidentifier,
@eventID uniqueidentifier
select @constituentID=CONSTITUENTID, @eventID=EVENTID from dbo.REGISTRANT where ID = @REGISTRANTID
select @emailCount = count(ID) from dbo.FAFCOMMUNICATIONSLOG where (MESSAGETYPECODE=1 or MESSAGETYPECODE=2 or MESSAGETYPECODE=4) and CLIENTUSERSID=dbo.UFN_CLIENTUSERID_GET_BY_CONSTITUENT(@constituentID) and EVENTID=@eventID
select @socialNetworkPostCount=count(ID) from dbo.FAFEVENTSOCIALNETWORKPOST where REGISTRANTID=@REGISTRANTID
set @totalCount = @emailCount + @socialNetworkPostCount
return @totalcount
end