USP_SALESORDER_STATUS_UPDATE_TOUNRESOLVED

Executes the "Sales Order Update Status To Unresolved Record Operation" record operation.

Parameters

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

Definition

Copy


                    create procedure dbo.USP_SALESORDER_STATUS_UPDATE_TOUNRESOLVED
                    (
                        @ID uniqueidentifier,
                        @CHANGEAGENTID uniqueidentifier
                    )
                    as begin

                        declare @CURRENTSTATUSCODE tinyint = 0
                        select @CURRENTSTATUSCODE = [STATUSCODE] from dbo.[SALESORDER] where [ID] = @ID

                        begin try
                            if @CURRENTSTATUSCODE <> 1
                                update dbo.[SALESORDER]
                                set 
                                    [STATUSCODE] = 7,
                                    [CHANGEDBYID] = @CHANGEAGENTID,
                                    [DATECHANGED] = getdate()
                                where [ID] = @ID
                            else
                                raiserror('BBERR_ORDERCOMPLETE', 13, 1);
                        end try
                        begin catch
                            exec dbo.USP_RAISE_ERROR
                            return 1
                        end catch

                        return 0;
                    end