USP_DATAFORMTEMPLATE_ADD_EXCHANGEEMAILBATCHROW

The save procedure used by the add dataform template "Exchange Email Batch Row Add Form".

Parameters

Parameter Parameter Type Mode Description
@ID uniqueidentifier INOUT The output parameter indicating the ID of the record added.
@CHANGEAGENTID uniqueidentifier IN Input parameter indicating the ID of the change agent invoking the procedure.
@BATCHID uniqueidentifier IN Input parameter indicating the context ID for the record being added.
@ADDASINTERACTION bit IN Process
@SEQUENCE int IN Sequence
@SITES xml IN Sites
@CONSTITUENTID uniqueidentifier IN Constituent
@USERID uniqueidentifier IN User
@DATESENT datetime IN Date
@TIMESENT UDT_HOURMINUTE IN Time
@SUBJECT nvarchar(256) IN Subject
@BODY nvarchar(max) IN Body
@INTERACTIONTYPECODEID uniqueidentifier IN Type

Definition

Copy

                    CREATE procedure dbo.USP_DATAFORMTEMPLATE_ADD_EXCHANGEEMAILBATCHROW
                    (
                        @ID uniqueidentifier output,  
                        @CHANGEAGENTID uniqueidentifier,
                        @BATCHID uniqueidentifier,
                        @ADDASINTERACTION bit,
                        @SEQUENCE int,
                        @SITES xml = null,
                        @CONSTITUENTID uniqueidentifier = null,
                        @USERID uniqueidentifier = null,
                        @DATESENT datetime = null,
                        @TIMESENT UDT_HOURMINUTE = null,
                        @SUBJECT nvarchar(256) = null
                        @BODY nvarchar(max) = null,                
                        @INTERACTIONTYPECODEID uniqueidentifier = null
                    )
                    as 
                    set nocount on;

                    declare @CHANGEDATE datetime

                    if @ID is null
                        set @ID = NewID();

                    if @CHANGEAGENTID is null
                        exec dbo.USP_CHANGEAGENT_GETORCREATECHANGEAGENT @CHANGEAGENTID output

                    set @CHANGEDATE = getdate();

                    begin try
                        insert into dbo.EXCHANGEEMAILBATCH(ID, ADDASINTERACTION, SEQUENCE, BATCHID, CONSTITUENTID, USERID, DATESENT, TIMESENT, SUBJECT, BODY, INTERACTIONTYPECODEID, CHANGEDBYID, DATECHANGED, ADDEDBYID, DATEADDED)
                        values(@ID, @ADDASINTERACTION, @SEQUENCE, @BATCHID, @CONSTITUENTID, @USERID, @DATESENT, @TIMESENT, @SUBJECT, @BODY, @INTERACTIONTYPECODEID, @CHANGEAGENTID, @CHANGEDATE, @CHANGEAGENTID, @CHANGEDATE);
                        exec dbo.USP_EXCHANGEEMAILBATCH_GETSITES_ADDFROMXML @ID, @SITES, @CHANGEAGENTID, @CHANGEDATE;

                    end try
                    begin catch
                        exec dbo.USP_RAISE_ERROR;
                        return 1;
                    end catch

                    return 0;