USP_RECORDOPERATION_WEALTHUPDATES_DISABLE

Executes the "WealthPoint Updates: Disable" record operation.

Parameters

Parameter Parameter Type Mode Description
@ID uniqueidentifier IN Input parameter indicating the ID of the record being updated.
@CURRENTAPPUSERID uniqueidentifier IN Input parameter indicating the ID of the current user.
@CHANGEAGENTID uniqueidentifier IN Input parameter indicating the ID of the change agent invoking the update.

Definition

Copy


                    create procedure dbo.USP_RECORDOPERATION_WEALTHUPDATES_DISABLE (
                        @ID uniqueidentifier,
                        @CURRENTAPPUSERID uniqueidentifier,
                        @CHANGEAGENTID uniqueidentifier = null
                    ) as begin
                        if @CHANGEAGENTID is null  
                            exec dbo.USP_CHANGEAGENT_GETORCREATECHANGEAGENT @CHANGEAGENTID output

                        declare @CURRENTDATE datetime
                        set @CURRENTDATE = getdate()


                        begin try                            
                            --check for pending wealthpoint updates

                            if exists(select 1 from dbo.DISABLEDWEALTHUPDATES where ID=@ID) begin
                                raiserror('WealthPoint updates are already disabled for this constituent.', 13, 1);
                                return 1;
                            end

                            insert into dbo.DISABLEDWEALTHUPDATES
                            (
                                [ID],
                                [ADDEDBYID],
                                [CHANGEDBYID],
                                [DATEADDED],
                                [DATECHANGED]

                            )
                            values
                            (
                                @ID,
                                @CHANGEAGENTID,
                                @CHANGEAGENTID,
                                @CURRENTDATE,
                                @CURRENTDATE

                            )

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

                        return 0;
                    end