USP_DATAFORMTEMPLATE_ADD_PRENOTIFICATIONPROCESS_2

The save procedure used by the add dataform template "Prenotification Process Add Form 2".

Parameters

Parameter Parameter Type Mode Description
@ID uniqueidentifier INOUT The output parameter indicating the ID of the record added.
@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
@IDSETREGISTERID uniqueidentifier IN Selection
@DATETYPECODE tinyint IN Financial processing date
@DATE datetime IN Specific date
@SPONSORINGINSTITUTIONID uniqueidentifier IN Sponsoring institution
@IMMEDIATEDESTINATIONNAME nvarchar(23) IN Immediate destination name
@CREATECREDITOFFSETTRANSACTION bit IN Create credit offset transaction
@CREATEOUTPUTIDSET bit IN Create selection from results
@OUTPUTIDSETNAME nvarchar(100) IN Selection name
@OVERWRITEOUTPUTIDSET bit IN Overwrite existing selection
@CURRENTAPPUSERID uniqueidentifier IN Input parameter indicating the ID of the current user.
@BANKACCOUNTID uniqueidentifier IN Bank account
@SITEID uniqueidentifier IN

Definition

Copy


                    CREATE procedure dbo.USP_DATAFORMTEMPLATE_ADD_PRENOTIFICATIONPROCESS_2
                    (
                        @ID uniqueidentifier = null output,
                        @CHANGEAGENTID uniqueidentifier = null,
                        @NAME nvarchar(100), 
                        @DESCRIPTION nvarchar(255)=''
                        @IDSETREGISTERID uniqueidentifier = null,
                        @DATETYPECODE tinyint = 0,
                        @DATE datetime = null,
                        @SPONSORINGINSTITUTIONID uniqueidentifier = '',
                        @IMMEDIATEDESTINATIONNAME nvarchar(23) = '',
                        @CREATECREDITOFFSETTRANSACTION bit = 0,
                        @CREATEOUTPUTIDSET bit = 0,
                        @OUTPUTIDSETNAME nvarchar(100) = ''
                        @OVERWRITEOUTPUTIDSET bit = 0,
                        @CURRENTAPPUSERID uniqueidentifier,
                        @BANKACCOUNTID uniqueidentifier = null,
                        @SITEID uniqueidentifier = null
                    )
                    as
                    set nocount on;

                    declare @CURRENTDATE datetime;

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

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

                    set @CURRENTDATE = GetDate();

                    begin try

                    if (@SITEID is not null
                        begin
                            if dbo.UFN_SITEALLOWEDFORUSER(@CURRENTAPPUSERID, @SITEID) = 0 
                            begin
                                raiserror ('ERR_SITE_NOACCESS',13,1);
                                return 1;
                            end
                        end

                        insert into dbo.PRENOTIFICATIONPROCESS
                            (ID,NAME,DESCRIPTION,IDSETREGISTERID,DATETYPECODE,DATE,SPONSORINGINSTITUTIONID,BANKACCOUNTID,IMMEDIATEDESTINATIONNAME,CREATECREDITOFFSETTRANSACTION,CREATEOUTPUTIDSET,OUTPUTIDSETNAME,OVERWRITEOUTPUTIDSET,ADDEDBYID,CHANGEDBYID,DATEADDED,DATECHANGED)
                        values
                            (@ID,@NAME,@DESCRIPTION,@IDSETREGISTERID,@DATETYPECODE,@DATE,@SPONSORINGINSTITUTIONID,@BANKACCOUNTID,@IMMEDIATEDESTINATIONNAME,@CREATECREDITOFFSETTRANSACTION,@CREATEOUTPUTIDSET,@OUTPUTIDSETNAME,@OVERWRITEOUTPUTIDSET,@CHANGEAGENTID,@CHANGEAGENTID,@CURRENTDATE,@CURRENTDATE);

                        exec dbo.USP_BUSINESSPROCESSINSTANCE_ADD 
                                @CHANGEAGENTID = @CHANGEAGENTID
                                @BUSINESSPROCESSCATALOGID = 'F327E3A6-06F8-4816-BE25-BC004E73C802'
                                @BUSINESSPROCESSPARAMETERSETID = @ID
                                @OWNERID = @CURRENTAPPUSERID,
                                @SITEID = @SITEID;
                    end try

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

                    return 0;