USP_DATAFORM_EDITLOAD_MAILPREFERENCE_3
The load procedure used by the edit dataform template "Mail Preference Edit Form 3"
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. |
| @CONSTITUENTID | uniqueidentifier | INOUT | Constituent |
| @ISORG | bit | INOUT | |
| @MAILTYPECODE | tinyint | INOUT | Mail type |
| @ACKNOWLEDGEMENTID | uniqueidentifier | INOUT | Selected communication |
| @CORRESPONDENCEID | uniqueidentifier | INOUT | Selected communication |
| @PLEDGEREMINDERID | uniqueidentifier | INOUT | Selected communication |
| @BUSINESSUNITCODEID | uniqueidentifier | INOUT | Business unit |
| @CATEGORYCODEID | uniqueidentifier | INOUT | Category |
| @EVENTCATEGORYCODEID | uniqueidentifier | INOUT | Category |
| @SITEID | uniqueidentifier | INOUT | Site |
| @CORRESPONDENCECODEID | uniqueidentifier | INOUT | Correspondence code |
| @RECEIPTTYPECODE | int | INOUT | Receipt type |
| @SENDMAIL | bit | INOUT | Send mail |
| @DELIVERYMETHODCODE | tinyint | INOUT | Send by |
| @CONTACTTYPES | xml | INOUT | Send to contact(s) |
| @ADDRESSID | uniqueidentifier | INOUT | Selected address |
| @EMAILADDRESSID | uniqueidentifier | INOUT | Selected address |
| @USESEASONALADDRESS | bit | INOUT | Send to seasonal address when valid |
| @USEPRIMARYADDRESS | bit | INOUT | Send to primary address |
| @COMMENTS | nvarchar(500) | INOUT | Comments |
| @TSLONG | bigint | INOUT | Output parameter indicating the TSLONG value of the record being edited. This is used to manage multi-user concurrency issues when multiple users access the same record. |
| @ISGROUP | bit | INOUT | Is group |
| @GROUPCONTACTS | xml | INOUT | |
| @USEPRIMARYEMAIL | bit | INOUT | Send to primary email |
| @PURPOSEID | uniqueidentifier | INOUT | Fundraising Purpose |
| @CURRENTAPPUSERID | uniqueidentifier | IN | Input parameter indicating the ID of the current user. |
| @SITEREQUIRED | bit | INOUT | Site Required |
| @DONOTSENDOTHERCHANNEL | bit | INOUT | |
| @ISNOPREFERENCE | bit | INOUT | |
| @LINKEDCONSTITUENTSOLICITCODEID | uniqueidentifier | INOUT | |
| @HASINHERITEDCONSENT | bit | INOUT | |
| @SOURCEEVIDENCECODEID | uniqueidentifier | INOUT | |
| @SOURCEFILE | nvarchar(260) | INOUT | |
| @PRIVACYPOLICY | nvarchar(260) | INOUT | |
| @SUPPORTINGINFORMATION | nvarchar(max) | INOUT | |
| @CONSENTSTATEMENT | nvarchar(max) | INOUT |
Definition
Copy
CREATE procedure dbo.USP_DATAFORM_EDITLOAD_MAILPREFERENCE_3
(
@ID uniqueidentifier,
@DATALOADED bit = 0 output,
@CONSTITUENTID uniqueidentifier = null output,
@ISORG bit = null output,
@MAILTYPECODE tinyint = null output,
@ACKNOWLEDGEMENTID uniqueidentifier = null output,
@CORRESPONDENCEID uniqueidentifier = null output,
@PLEDGEREMINDERID uniqueidentifier = null output,
@BUSINESSUNITCODEID uniqueidentifier = null output,
@CATEGORYCODEID uniqueidentifier = null output,
@EVENTCATEGORYCODEID uniqueidentifier = null output,
@SITEID uniqueidentifier = null output,
@CORRESPONDENCECODEID uniqueidentifier = null output,
@RECEIPTTYPECODE int = null output,
@SENDMAIL bit = null output,
@DELIVERYMETHODCODE tinyint = null output,
@CONTACTTYPES xml = null output,
@ADDRESSID uniqueidentifier = null output,
@EMAILADDRESSID uniqueidentifier = null output,
@USESEASONALADDRESS bit = null output,
@USEPRIMARYADDRESS bit = null output,
@COMMENTS nvarchar(500) = null output,
@TSLONG bigint = 0 output,
@ISGROUP bit = null output,
@GROUPCONTACTS xml = null output,
@USEPRIMARYEMAIL bit = null output,
@PURPOSEID uniqueidentifier = null output,
@CURRENTAPPUSERID uniqueidentifier = null,
@SITEREQUIRED bit = null output,
@DONOTSENDOTHERCHANNEL bit = null output,
@ISNOPREFERENCE bit = null output,
@LINKEDCONSTITUENTSOLICITCODEID uniqueidentifier = null output,
@HASINHERITEDCONSENT bit = null output,
@SOURCEEVIDENCECODEID uniqueidentifier = null output,
@SOURCEFILE nvarchar(260) = null output,
@PRIVACYPOLICY nvarchar(260) = null output,
@SUPPORTINGINFORMATION nvarchar(max) = null output,
@CONSENTSTATEMENT nvarchar(max) = null output
)
as
set nocount on;
declare @DEFAULTSITEFORUSER uniqueidentifier = dbo.UFN_APPUSER_DEFAULTSITEFORUSER(@CURRENTAPPUSERID);
begin try
select
@DATALOADED = 1,
@CONSTITUENTID = CONSTITUENTID,
@MAILTYPECODE = MAILTYPECODE,
@ACKNOWLEDGEMENTID = ACKNOWLEDGEMENTID,
@CORRESPONDENCEID = CORRESPONDENCEID,
@PLEDGEREMINDERID = PLEDGEREMINDERID,
@BUSINESSUNITCODEID = BUSINESSUNITCODEID,
@CATEGORYCODEID = CATEGORYCODEID,
@EVENTCATEGORYCODEID = EVENTCATEGORYCODEID,
@SITEID = coalesce(SITEID, @DEFAULTSITEFORUSER),
@CORRESPONDENCECODEID = CORRESPONDENCECODEID,
@RECEIPTTYPECODE = RECEIPTTYPECODE,
@SENDMAIL = SENDMAIL,
@DELIVERYMETHODCODE = DELIVERYMETHODCODE,
@ADDRESSID = ADDRESSID,
@EMAILADDRESSID = EMAILADDRESSID,
@USESEASONALADDRESS = USESEASONALADDRESS,
@USEPRIMARYADDRESS = USEPRIMARYADDRESS,
@COMMENTS = COMMENTS,
@USEPRIMARYEMAIL = USEPRIMARYEMAIL,
@PURPOSEID = PURPOSEID,
@DONOTSENDOTHERCHANNEL = DONOTSENDOTHERCHANNEL,
@ISNOPREFERENCE = 0,
@LINKEDCONSTITUENTSOLICITCODEID = CONSTITUENTSOLICITCODEID,
@HASINHERITEDCONSENT = HASINHERITEDCONSENT
from dbo.MAILPREFERENCE
where ID = @ID;
if @HASINHERITEDCONSENT = 0
begin
-- Consent is not inherited. Data is in the MAILPREFERENCE table.
select
@SOURCEEVIDENCECODEID = SOURCECODEID,
@SOURCEFILE = SOURCEFILEPATH,
@PRIVACYPOLICY = PRIVACYPOLICYFILEPATH,
@SUPPORTINGINFORMATION = SUPPORTINGINFORMATION,
@CONSENTSTATEMENT = CONSENTSTATEMENT
from dbo.MAILPREFERENCE
where ID = @ID;
end
else
begin
-- Consent is inherited. Data is in the CONSTITUENTSOLICITCODE table.
select
@SOURCEEVIDENCECODEID = SOURCECODEID,
@SOURCEFILE = SOURCEFILEPATH,
@PRIVACYPOLICY = PRIVACYPOLICYFILEPATH,
@SUPPORTINGINFORMATION = SUPPORTINGINFORMATION,
@CONSENTSTATEMENT = CONSENTSTATEMENT
from dbo.CONSTITUENTSOLICITCODE
where ID = @LINKEDCONSTITUENTSOLICITCODEID;
end
select
@ISORG = ISORGANIZATION,
@ISGROUP = ISGROUP
from dbo.CONSTITUENT
where ID = @CONSTITUENTID;
set @CONTACTTYPES = dbo.UFN_MAILPREFERENCE_GETCONTACTTYPES_TOITEMLISTXML(@ID);
set @GROUPCONTACTS = dbo.UFN_MAILPREFERENCE_GETGROUPCONTACTS_TOITEMLISTXML(@ID);
set @SITEREQUIRED = dbo.UFN_SITEREQUIREDFORUSER(@CURRENTAPPUSERID);
end try
begin catch
exec dbo.USP_RAISE_ERROR;
return 1;
end catch
return 0;