USP_DATAFORMTEMPLATE_EDIT_BATCHPHONEFINDERBATCHROW

The save procedure used by the edit dataform template "PhoneFinder Batch Row Edit Form".

Parameters

Parameter Parameter Type Mode Description
@ID uniqueidentifier IN The input ID parameter indicating the ID of the record being edited.
@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_EDIT_BATCHPHONEFINDERBATCHROW
(
    @ID uniqueidentifier,
    @CHANGEAGENTID uniqueidentifier,
    @SEQUENCE int,
    @PHONEFINDERID uniqueidentifier,
    @CONSTITUENTID uniqueidentifier,
    @ADDRESSID uniqueidentifier,
    @PHONENUMBER nvarchar(20),
    @PHONEMATCHTYPE nvarchar(1),
    @MATCHCOMPOSITESCORE nvarchar(5),
    @PHONESTATUS nvarchar(1),
    @DONOTCALLSTATUS nvarchar(1)
)
as begin
    set nocount on;

    declare @CURRENTDATE datetime = getdate();

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

    begin try
    update dbo.BATCHPHONEFINDER
        set
            [SEQUENCE] = @SEQUENCE,
            [CHANGEDBYID] = @CHANGEAGENTID,
            [DATECHANGED] = @CURRENTDATE,
            [PHONEFINDERID] = @PHONEFINDERID,
            [CONSTITUENTID] = @CONSTITUENTID,
            [ADDRESSID] = @ADDRESSID,
            [PHONENUMBER] = coalesce(@PHONENUMBER, ''),
            [PHONEMATCHTYPE] = @PHONEMATCHTYPE,
            [MATCHCOMPOSITESCORE] = @MATCHCOMPOSITESCORE,
            [PHONESTATUS] = @PHONESTATUS,
            [DONOTCALLSTATUS] = @DONOTCALLSTATUS
        where
            BATCHPHONEFINDER.[ID] = @ID;
    end try
    begin catch
        exec dbo.USP_RAISE_ERROR;
        return 1;
    end catch

    return 0;
end