USP_DATAFORMTEMPLATE_ADD_BATCHPHONEFINDERBATCHROW

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

Parameters

Parameter Parameter Type Mode Description
@ID uniqueidentifier INOUT The output parameter indicating the ID of the record added.
@BATCHID 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.
@SEQUENCE int IN Sequence
@PHONEFINDERID uniqueidentifier IN
@CONSTITUENTID uniqueidentifier IN Constituent
@ADDRESSID uniqueidentifier IN
@PHONENUMBER nvarchar(20) IN Phone number
@PHONEMATCHTYPE nvarchar(1) IN Phone match type
@MATCHCOMPOSITESCORE nvarchar(5) IN Match composite score
@PHONESTATUS nvarchar(1) IN Phone status
@DONOTCALLSTATUS nvarchar(1) IN Do not call status

Definition

Copy

CREATE procedure dbo.USP_DATAFORMTEMPLATE_ADD_BATCHPHONEFINDERBATCHROW
(
    @ID uniqueidentifier = null output,
    @BATCHID uniqueidentifier,
    @CHANGEAGENTID uniqueidentifier,
    @SEQUENCE int,
    @PHONEFINDERID uniqueidentifier = null,
    @CONSTITUENTID uniqueidentifier = null,
    @ADDRESSID uniqueidentifier = null,
    @PHONENUMBER nvarchar(20) = null,
    @PHONEMATCHTYPE nvarchar(1) = null,
    @MATCHCOMPOSITESCORE nvarchar(5) = null,
    @PHONESTATUS nvarchar(1) = null,
    @DONOTCALLSTATUS nvarchar(1) = null
)
as begin
    set nocount on;

    declare @CURRENTDATE datetime = getdate();

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

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

    begin try

    insert into dbo.BATCHPHONEFINDER
    (
        [ID],
        [BATCHID],
        [SEQUENCE],
        [ADDEDBYID],
        [CHANGEDBYID],
        [DATEADDED],
        [DATECHANGED],
        [PHONEFINDERID],
        [CONSTITUENTID],
        [ADDRESSID],
        [PHONENUMBER],
        [PHONEMATCHTYPE],
        [MATCHCOMPOSITESCORE],
        [PHONESTATUS],
        [DONOTCALLSTATUS]
    ) values (
        @ID,
        @BATCHID,
        @SEQUENCE,
        @CHANGEAGENTID,
        @CHANGEAGENTID,
        @CURRENTDATE,
        @CURRENTDATE,
        @PHONEFINDERID,
        @CONSTITUENTID,
        @ADDRESSID,
        coalesce(@PHONENUMBER, ''),
        @PHONEMATCHTYPE,
        @MATCHCOMPOSITESCORE,
        @PHONESTATUS,
        @DONOTCALLSTATUS
    );
    end try
    begin catch
        exec.dbo.USP_RAISE_ERROR;
        return 1;
    end catch

    return 0;
end