USP_DATAFORMTEMPLATE_ADD_EMAIL_COPYTOHOUSEHOLD
The save procedure used by the add dataform template "Email Copy To Household Add Form".
Parameters
| Parameter | Parameter Type | Mode | Description |
|---|---|---|---|
| @ID | uniqueidentifier | INOUT | The output parameter indicating the ID of the record added. |
| @EMAILADDRESSID | uniqueidentifier | IN | Input parameter indicating the context ID for the record being added. |
| @CHANGEAGENTID | uniqueidentifier | IN | Input parameter indicating the ID of the change agent invoking the procedure. |
| @CONSTITUENTID | uniqueidentifier | IN | Spouse ID |
| @EMAILADDRESSTYPECODEID | uniqueidentifier | IN | Type |
| @EMAILADDRESS | UDT_EMAILADDRESS | IN | Email address |
| @PRIMARY | bit | IN | Set as primary email address |
| @DONOTEMAIL | bit | IN | Do not send email to this address |
| @INFOSOURCECODEID | uniqueidentifier | IN | Information source |
| @INFOSOURCECOMMENTS | nvarchar(256) | IN | Comments |
| @CONSTITUENTDATAREVIEWROLLBACKREASONID | uniqueidentifier | IN | Reason |
| @STARTDATE | date | IN | Start date |
| @ENDDATE | date | IN | End date |
Definition
Copy
CREATE procedure dbo.USP_DATAFORMTEMPLATE_ADD_EMAIL_COPYTOHOUSEHOLD
(
@ID uniqueidentifier = null output,
@EMAILADDRESSID uniqueidentifier,
@CHANGEAGENTID uniqueidentifier = null,
@CONSTITUENTID uniqueidentifier = null,
@EMAILADDRESSTYPECODEID uniqueidentifier = null,
@EMAILADDRESS dbo.UDT_EMAILADDRESS,
@PRIMARY bit = null,
@DONOTEMAIL bit = null,
@INFOSOURCECODEID uniqueidentifier = null,
@INFOSOURCECOMMENTS nvarchar(256) = '',
@CONSTITUENTDATAREVIEWROLLBACKREASONID uniqueidentifier = null, -- used by constituent data review
@STARTDATE date = null,
@ENDDATE date = null
)
as
set nocount on;
declare @CURRENTDATE datetime;
set @CURRENTDATE = getdate();
if @CHANGEAGENTID is null
exec dbo.USP_CHANGEAGENT_GETORCREATECHANGEAGENT @CHANGEAGENTID output;
if @PRIMARY = 0 and not exists(select ID from dbo.EMAILADDRESS where CONSTITUENTID = @CONSTITUENTID and ISPRIMARY = 1)
raiserror('BBERR_NOPRIMARY', 13, 1);
exec dbo.USP_EMAILADDRESS_CREATE
@ID output,
@CHANGEAGENTID,
@CURRENTDATE,
@CONSTITUENTID,
@EMAILADDRESSTYPECODEID,
@EMAILADDRESS,
@PRIMARY,
@DONOTEMAIL,
@INFOSOURCECODEID,
@INFOSOURCECOMMENTS,
@STARTDATE = @STARTDATE;
--Update the end date since USP_EMAILADDRESS_CREATE does everything we want except this.
update dbo.EMAILADDRESS set ENDDATE = @ENDDATE where ID = @ID;
return 0;