USP_DATAFORMTEMPLATE_ADD_CONTACTREPORTFILENOCONTEXT

The save procedure used by the add dataform template "Contact Report File No Context Add Form".

Parameters

Parameter Parameter Type Mode Description
@ID uniqueidentifier INOUT The output parameter indicating the ID of the record added.
@FUNDRAISERID 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.
@ACTUALDATE datetime IN Actual date
@OWNERID uniqueidentifier IN Owner
@INTERACTIONTYPECODEID uniqueidentifier IN Contact Method
@OBJECTIVE nvarchar(100) IN Objective
@PROSPECTPLANSTATUSCODEID uniqueidentifier IN Stage
@COMMENT nvarchar(max) IN Comment
@ADDITIONALFUNDRAISERS xml IN Additional solicitors
@PARTICIPANTS xml IN Participants
@INTERACTIONCATEGORYID uniqueidentifier IN Category
@INTERACTIONSUBCATEGORYID uniqueidentifier IN Subcategory
@NEXTSTEPID uniqueidentifier IN ID
@EDITNEXTSTEP bit IN Edit next step information
@NEXTSTEPOBJECTIVE nvarchar(100) IN Objective
@NEXTSTEPOWNERID uniqueidentifier IN Owner
@NEXTSTEPSTATUSCODE tinyint IN Status
@NEXTSTEPEXPECTEDDATE datetime IN Expected date
@NEXTSTEPACTUALDATE datetime IN Actual date
@PROSPECTID uniqueidentifier IN Prospect
@PROSPECTPLANID uniqueidentifier IN Prospect plan
@ACTUALSTARTTIME UDT_HOURMINUTE IN Actual start time
@ACTUALENDTIME UDT_HOURMINUTE IN Actual end time

Definition

Copy


                    CREATE procedure dbo.USP_DATAFORMTEMPLATE_ADD_CONTACTREPORTFILENOCONTEXT
                    (
                        @ID uniqueidentifier = null output,
                        @FUNDRAISERID uniqueidentifier,
                        @CHANGEAGENTID uniqueidentifier = null,
                        @ACTUALDATE datetime = null,
                        @OWNERID uniqueidentifier = null,
                        @INTERACTIONTYPECODEID uniqueidentifier = null,
                        @OBJECTIVE nvarchar(100) = '',
                        @PROSPECTPLANSTATUSCODEID uniqueidentifier = null,
                        @COMMENT nvarchar(max) = '',
                        @ADDITIONALFUNDRAISERS xml = null,
                        @PARTICIPANTS xml = null,
                        @INTERACTIONCATEGORYID uniqueidentifier = null,
                        @INTERACTIONSUBCATEGORYID uniqueidentifier = null,
                        @NEXTSTEPID uniqueidentifier = null,
                        @EDITNEXTSTEP bit = 0,
                        @NEXTSTEPOBJECTIVE nvarchar(100) = '',
                        @NEXTSTEPOWNERID uniqueidentifier = null,
                        @NEXTSTEPSTATUSCODE tinyint = 0,
                        @NEXTSTEPEXPECTEDDATE datetime = null,
                        @NEXTSTEPACTUALDATE datetime = null,
                        @PROSPECTID uniqueidentifier = null,
                        @PROSPECTPLANID uniqueidentifier = null,
                        @ACTUALSTARTTIME dbo.UDT_HOURMINUTE = '',
                        @ACTUALENDTIME dbo.UDT_HOURMINUTE = ''
                    )
                    as
                    begin
                        set nocount on;

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

                        declare @EXPECTEDDATE datetime;
                        set @EXPECTEDDATE = @ACTUALDATE;

                        declare @CURRENTDATE datetime;
                        set @CURRENTDATE = getdate();

                        begin try

                            exec dbo.USP_STEP_ADD @ID output, @CHANGEAGENTID, @PROSPECTPLANID, @EXPECTEDDATE, @ACTUALDATE, 2, @OWNERID
                                @INTERACTIONTYPECODEID, @OBJECTIVE, @PROSPECTPLANSTATUSCODEID, @COMMENT, @ADDITIONALFUNDRAISERS, @PARTICIPANTS
                                @INTERACTIONSUBCATEGORYID, '', '', null, 1, @ACTUALSTARTTIME, @ACTUALENDTIME;

                            if @EDITNEXTSTEP = 1
                            begin
                                update dbo.INTERACTION
                                set
                                    OBJECTIVE = @NEXTSTEPOBJECTIVE,
                                    FUNDRAISERID = @NEXTSTEPOWNERID,
                                    STATUSCODE = @NEXTSTEPSTATUSCODE,
                                    EXPECTEDDATE = @NEXTSTEPEXPECTEDDATE,
                                    ACTUALDATE = @NEXTSTEPACTUALDATE,
                                    CHANGEDBYID = @CHANGEAGENTID,
                                    DATECHANGED = @CURRENTDATE
                                    ACTUALSTARTTIME = @ACTUALSTARTTIME,
                                    ACTUALENDTIME = @ACTUALENDTIME
                                where
                                    INTERACTION.ID = @NEXTSTEPID;
                            end

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

                        return 0;

                    end