USP_DATAFORMTEMPLATE_ADD_PLANPARTICIPANT

The save procedure used by the add dataform template "Plan Participant Add Form".

Parameters

Parameter Parameter Type Mode Description
@ID uniqueidentifier INOUT The output parameter indicating the ID of the record added.
@PROSPECTPLANID uniqueidentifier IN Input parameter indicating the context ID for the record being added.
@CONSTITUENTID uniqueidentifier IN Constituent
@PLANPARTICIPANTROLECODEID uniqueidentifier IN Role
@CHANGEAGENTID uniqueidentifier IN Input parameter indicating the ID of the change agent invoking the procedure.

Definition

Copy


                    CREATE procedure dbo.USP_DATAFORMTEMPLATE_ADD_PLANPARTICIPANT (
                        @ID uniqueidentifier = null output,
                        @PROSPECTPLANID uniqueidentifier,
                        @CONSTITUENTID uniqueidentifier,
                        @PLANPARTICIPANTROLECODEID uniqueidentifier = null,
                        @CHANGEAGENTID uniqueidentifier = null
                    ) as begin
                        set nocount on;

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

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

                        begin try
                            insert into dbo.PLANPARTICIPANT (
                                ID,
                                PROSPECTPLANID,
                                CONSTITUENTID,
                                PLANPARTICIPANTROLECODEID,
                                ADDEDBYID,
                                CHANGEDBYID,
                                DATEADDED,
                                DATECHANGED
                            ) values (
                                @ID,
                                @PROSPECTPLANID,
                                @CONSTITUENTID,
                                @PLANPARTICIPANTROLECODEID,
                                @CHANGEAGENTID,
                                @CHANGEAGENTID,
                                getdate(),
                                getdate()          
                            )

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

                        return 0

                    end