USP_DATAFORMTEMPLATE_VIEW_CONSTITUENTCORRESPONDENCEPREVIEWACKNOWLEDGEMENT
The load procedure used by the view dataform template "Constituent Correspondence Preview Acknowledgement View Form"
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@ID | uniqueidentifier | IN | The input ID parameter used to load the fields defined on the form. |
@DATALOADED | bit | INOUT | Output parameter indicating whether or not data was actually loaded. |
@DATESENT | datetime | INOUT | Date Sent |
@CORRESPONDENCETYPE | nvarchar(100) | INOUT | Communication |
@DETAILS | nvarchar(100) | INOUT | Details |
@CATEGORY | nvarchar(100) | INOUT | Category |
@ADDEDBY | nvarchar(128) | INOUT | Added By |
@COMMENT | nvarchar(255) | INOUT | Comments |
@RESPONSES | xml | INOUT | Responses |
@SITE | nvarchar(1024) | INOUT | Site |
Definition
Copy
CREATE procedure dbo.USP_DATAFORMTEMPLATE_VIEW_CONSTITUENTCORRESPONDENCEPREVIEWACKNOWLEDGEMENT(
@ID uniqueidentifier,
@DATALOADED bit = 0 output,
@DATESENT datetime = null output,
@CORRESPONDENCETYPE nvarchar(100) = null output,
@DETAILS nvarchar(100) = null output,
@CATEGORY nvarchar(100) = null output,
@ADDEDBY nvarchar(128) = null output,
@COMMENT nvarchar(255) = null output,
@RESPONSES xml = null output,
@SITE nvarchar(1024) = null output
) as begin
set nocount on;
set @DATALOADED = 0;
select
@DATALOADED = 1,
@DATESENT = RL.ACKNOWLEDGEDATE,
@CORRESPONDENCETYPE = 'Acknowledgement',
@DETAILS = case when RL.MKTPACKAGEID is not null then
(select COMMUNICATIONLETTER.NAME from dbo.COMMUNICATIONLETTER where COMMUNICATIONLETTER.EMAILPACKAGEID = RL.MKTPACKAGEID or COMMUNICATIONLETTER.MAILPACKAGEID = RL.MKTPACKAGEID)
else
AP.[NAME] + case when AP.[NAME] is not null and AP.[NAME] <> '' and LC.[NAME] is not null and LC.[NAME] <> '' then ' - ' else '' end + LC.[NAME]
end,
@CATEGORY = '',
@ADDEDBY = case when AU.USERNAME is not null then AU.USERNAME else CA.[USERNAME] end,
@COMMENT = '',
@RESPONSES = '<RESPONSES></RESPONSES>',
@SITE = coalesce(SITE.NAME, 'All sites')
from
dbo.[REVENUELETTER] RL
left join dbo.[LETTERCODE] LC on LC.[ID] = RL.[LETTERCODEID]
left join dbo.[ACKNOWLEDGEMENTPROCESSSTATUS] APS on APS.[ID] = RL.[ACKNOWLEDGEMENTPROCESSSTATUSID]
left join dbo.[BUSINESSPROCESSSTATUS] BPS on BPS.[ID] = RL.[ACKNOWLEDGEMENTPROCESSSTATUSID]
left join dbo.[ACKNOWLEDGEMENTPROCESS] AP on AP.[ID] = APS.[PARAMETERSETID]
left join dbo.[REVENUE] R on R.[ID] = RL.[REVENUEID]
left join dbo.[APPUSER] AU on AU.[ID] = BPS.[STARTEDBYUSERID]
left join dbo.[CHANGEAGENT] CA on CA.[ID] = RL.[ADDEDBYID]
left join dbo.BUSINESSPROCESSINSTANCE BPI on AP.ID = BPI.BUSINESSPROCESSPARAMETERSETID
left join dbo.SITE on SITE.ID = BPI.SITEID
where
R.ID = @ID
return 0
end