USP_EMAILSCHEDULE_ADD

The save procedure used by the add dataform template "Email Schedule Add Data 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.
@EMAILTEMPLATEID int IN Email Template ID
@RECURRENCEID uniqueidentifier IN Recurrence ID
@SCHEDULEENABLED bit IN Is Schedule Enabled
@SCHEDULENAME nvarchar(256) IN Schedule Name
@TIMETOQUEUE time IN Time to queue
@TIMEZONEID int IN Time Zone ID
@CLIENTUSERSID int IN Client Users ID
@CLIENTSITESID int IN CMS Site ID

Definition

Copy


          CREATE procedure dbo.USP_EMAILSCHEDULE_ADD
          (
            @ID uniqueidentifier = null output,
            @CHANGEAGENTID uniqueidentifier = null,
            @EMAILTEMPLATEID integer = 0,
            @RECURRENCEID uniqueidentifier = null,
            @SCHEDULEENABLED bit = false,
            @SCHEDULENAME nvarchar(256) = null,
            @TIMETOQUEUE time(0) = null,
            @TIMEZONEID integer = null,
            @CLIENTUSERSID integer = null,
            @CLIENTSITESID integer = null
          )
          as

          set nocount on;

          if @ID is null
            set @ID = newid()

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

          declare @CURRENTDATE datetime
          set @CURRENTDATE = getdate()

          begin try
              -- handle inserting the data

              insert into dbo.EMAILSCHEDULE
                (ID, EMAILTEMPLATEID, RECURRENCEID, SCHEDULEENABLED, ADDEDBYID, CHANGEDBYID, DATEADDED, DATECHANGED, SCHEDULENAME, TIMETOQUEUE, TIMEZONEID, CLIENTUSERSID, CLIENTSITESID)
            values
                (@ID, @EMAILTEMPLATEID, @RECURRENCEID, @SCHEDULEENABLED, @CHANGEAGENTID, @CHANGEAGENTID, @CURRENTDATE, @CURRENTDATE, @SCHEDULENAME, @TIMETOQUEUE, @TIMEZONEID, @CLIENTUSERSID, @CLIENTSITESID)

          end try

          begin catch
            exec dbo.USP_RAISE_ERROR
            return 1
          end catch

          return 0