USP_DATAFORMTEMPLATE_EDIT_ASSIGNCONSTITSECURITYATTRIBUTESPROCESS

The save procedure used by the edit dataform template "Assign Constituent Security Attributes Process 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.
@NAME nvarchar(100) IN Name
@DESCRIPTION nvarchar(255) IN Description
@SCOPEIDSETREGISTERID uniqueidentifier IN Selection of constituents to process
@CONSTIT_SECURITY_ATTRIBUTEID uniqueidentifier IN Group
@ASSIGNTOIDSETREGISTERID uniqueidentifier IN Selection of constituents to assign attribute to
@CREATEOUTPUTIDSET bit IN Create output selection
@OUTPUTIDSETNAME nvarchar(100) IN Selection name
@OVERWRITEOUTPUTIDSET bit IN Overwrite existing selection

Definition

Copy


CREATE procedure dbo.USP_DATAFORMTEMPLATE_EDIT_ASSIGNCONSTITSECURITYATTRIBUTESPROCESS
(
    @ID uniqueidentifier,
    @CHANGEAGENTID uniqueidentifier = null,
    @NAME nvarchar(100),
    @DESCRIPTION nvarchar(255) ,
    @SCOPEIDSETREGISTERID uniqueidentifier ,
    @CONSTIT_SECURITY_ATTRIBUTEID uniqueidentifier ,
    @ASSIGNTOIDSETREGISTERID uniqueidentifier,
    @CREATEOUTPUTIDSET bit,
    @OUTPUTIDSETNAME nvarchar(100) ,
    @OVERWRITEOUTPUTIDSET bit 
) as
    set nocount on;

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

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

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

    begin try
        update
            dbo.[ASSIGNCONSTITSECURITYATTRIBUTESPROCESS]
        set
            [NAME] = @NAME,
            [DESCRIPTION] = @DESCRIPTION,
            [SCOPEIDSETREGISTERID] = @SCOPEIDSETREGISTERID,
            [CONSTIT_SECURITY_ATTRIBUTEID] = @CONSTIT_SECURITY_ATTRIBUTEID,
            [ASSIGNTOIDSETREGISTERID] = @ASSIGNTOIDSETREGISTERID,
            [CREATEOUTPUTIDSET] = @CREATEOUTPUTIDSET,
            [OUTPUTIDSETNAME] = @OUTPUTIDSETNAME,
            [OVERWRITEOUTPUTIDSET] = @OVERWRITEOUTPUTIDSET,
            [CHANGEDBYID] = @CHANGEAGENTID,
            [DATECHANGED] = @CURRENTDATE
        where
            [ID] = @ID;
    end try
begin catch
    exec dbo.USP_RAISE_ERROR;
    return 1;
end catch

return 0;