USP_DATAFORMTEMPLATE_EDIT_PHONEFINDERPROCESSOPTIONS

The save procedure used by the edit dataform template "PhoneFinder Process Options Edit Data 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.
@INDIVIDUALMARKASPRIMARY bit IN Mark as primary
@ORGANIZATIONMARKASPRIMARY bit IN Mark as primary
@INDIVIDUALPHONETYPECODEID uniqueidentifier IN Individual phone type
@ORGANIZATIONPHONETYPECODEID uniqueidentifier IN Organization phone type
@INFOSOURCECODEID uniqueidentifier IN Information source

Definition

Copy


CREATE procedure dbo.USP_DATAFORMTEMPLATE_EDIT_PHONEFINDERPROCESSOPTIONS
(
    @ID uniqueidentifier,
    @CHANGEAGENTID uniqueidentifier = null,
    @INDIVIDUALMARKASPRIMARY bit,
    @ORGANIZATIONMARKASPRIMARY bit,
    @INDIVIDUALPHONETYPECODEID uniqueidentifier,
    @ORGANIZATIONPHONETYPECODEID uniqueidentifier,
    @INFOSOURCECODEID uniqueidentifier
)
as begin

    set nocount on;

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

    declare @CURRENTDATE datetime = getdate()

    begin try
        update dbo.PHONEFINDER set
            [INDIVIDUALMARKASPRIMARY] = @INDIVIDUALMARKASPRIMARY,
            [ORGANIZATIONMARKASPRIMARY] = @ORGANIZATIONMARKASPRIMARY,
            [INDIVIDUALPHONETYPECODEID] = @INDIVIDUALPHONETYPECODEID,
            [ORGANIZATIONPHONETYPECODEID] = @ORGANIZATIONPHONETYPECODEID,
            [INFOSOURCECODEID] = @INFOSOURCECODEID,
            [CHANGEDBYID] = @CHANGEAGENTID,
            [DATECHANGED] = @CURRENTDATE
        where ID = @ID
    end try
    begin catch
        exec dbo.USP_RAISE_ERROR;
        return 1;
    end catch

    return 0;
end