UFN_PROSPECTPLAN_STEPS_2
Returns the steps for a plan
Return
Return Type |
---|
table |
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@PROSPECTPLANID | uniqueidentifier | IN |
Definition
Copy
CREATE function dbo.UFN_PROSPECTPLAN_STEPS_2
(
@PROSPECTPLANID uniqueidentifier
)
returns table
as return
select
INTERACTION.ID,
INTERACTION.PLANOUTLINESTEPID,
INTERACTION.OBJECTIVE,
INTERACTION.FUNDRAISERID,
INTERACTION.PROSPECTPLANSTATUSCODEID,
INTERACTION.STATUSCODE,
INTERACTION.EXPECTEDDATE,
INTERACTION.ACTUALDATE,
INTERACTION.INTERACTIONTYPECODEID,
INTERACTION.CONSTITUENTID,
case
when exists (select ID from INTERACTIONADDITIONALFUNDRAISER where INTERACTIONID = INTERACTION.ID) then 1
else 0
end HASADDITIONALFUNDRAISERS,
dbo.UFN_INTERACTION_ADDITIONALFUNDRAISERS_TOITEMLISTXML(INTERACTION.ID) as ADDITIONALFUNDRAISERS,
INTERACTION.COMMENT,
-- Output FUNDRAISERID again, this time as OWNERID. Some of the forms need
-- this as OWNERID because FUNDRAISERID is used in a form field outside of the collection
-- and so the field ID can't be reused since they are both simplelists. FUNDRAISERID can't be
-- aliased since then the value wouldn't be updated in the generated code.
INTERACTION.FUNDRAISERID as OWNERID,
coalesce(INTERACTION.EXPECTEDSTARTTIME,'') as EXPECTEDSTARTTIME,
coalesce(INTERACTION.EXPECTEDENDTIME, '') as EXPECTEDENDTIME,
INTERACTION.TIMEZONEENTRYID,
INTERACTION.ISALLDAYEVENT,
coalesce(INTERACTION.ACTUALSTARTTIME,'') as ACTUALSTARTTIME,
coalesce(INTERACTION.ACTUALENDTIME,'') as ACTUALENDTIME,
INTERACTIONSUBCATEGORY.INTERACTIONCATEGORYID,
INTERACTION.INTERACTIONSUBCATEGORYID,
INTERACTION.LOCATION
from dbo.INTERACTION
left outer join dbo.INTERACTIONSUBCATEGORY on INTERACTION.INTERACTIONSUBCATEGORYID = INTERACTIONSUBCATEGORY.ID
where
PROSPECTPLANID = @PROSPECTPLANID
and COMPLETED = 0;