It is possible to extend the standard list of status types , so users can select custom status types to reflect their specific processes.

There are two parts to creating a new status. First, a codeunit needs to be created  to handle the processing of a status and second this codeunit must be registered in the list of available Status Type Codes

Creating a Status Processing Codeunit

To create a custom status a codeunit must be created that is based on the table Shpt. Mgt. Route CSPMTMN. This codeunit will be called with the specific route passed. The logic for processing the custom status should be added to the OnRun() trigger.

codeunit 50000 "Custom Status"
{
    TableNo = "Shpt. Mgt. Route CSPMTMN";

    trigger OnRun()
   
    end;
}

Registering the new Status

To register the new status, you should subscribe to the event OnAfterInsertStandardStatusCodes() in the "Std. Status Type Code" table.

[EventSubscriber(ObjectType::Table, DATABASE::"Std. Status Type Code CSPMTMN", 'OnAfterInsertStandardStatusCodes', '', false, false)]
Local procedure OnAfterInsertStandardStatusCodes()
Var
	StdStatusTypeCode: Record "Std. Status Type Code CSPMTMN"
Begin 
	StdStatusTypeCode.SetSuffix('SUFFIX')
	StdStatusTypeCode.InsertStandardCode('NEWCU', 'New Status Codeunit', 50000; 0, 'Explanation Text', false);
End;

SetSuffix sets a suffix to ensure the Code of the status is unique. This function has the following parameters:

Name Type Length Description
NewSuffix Code 8 Specifies the unique suffix for the registration.

InsertStatusCode then registers the new codeunit. This function has the following parameters:

Name Type Length Description
Code Code 10 Specifies the code for the status registration.
Description Text 50 Specifies the description for the status registration.
ProcessingCodeunit Integer Specifies the codeunit for the status registration as created in the step above.
Scope Option Specifies the scope of the status: 0 - All, 1 - Delivery Only, 2 - Collection Only, 3 - Production Only. The scope hides the status if it is not in scope for the route.
HelpInfo Text 1000 Detailed explanation of the status to help the user when deciding to add it to their process.
CanProcessDirectly Boolean Specify if a process outside the route can also complete the status and gives the setup option to prevent processing directly from the route. Unless there is specific logic to handle this, this should be set to false.