Sometimes users and even consultants get lost in the ribbon looking for action buttons. Now it´s a little easier with the help of ‘Tell me’ if you already know the name of what you are looking for. However, it´s not as intuitive as the Windows client just yet.
In this post I will show a way to change the status of a document without using the actions in the ribbon. It can be done directly on the field.
Although the ‘Release’ button group is quite visible, this functionality can be a little trick to do it more intuitive and reduce times for users that have to do it multiple times every day.
Checking the standard
First step to personalize is to know what the system is doing. If we want to modify the status field directly we need to know if there is any code behind the field in the table and page. As we can see it is using the ‘Sales Document Status’ enum and there is no code in the field:


Then we need to know how the actions work in order to replicate them. As we can see, the ‘Release Sales Document’ codeunit is called together with clearing totals:

Personalization
Now we need to enable the page field as it is not editable by default. As we can see, there are 4 options in the enum but we just need two of them (Open and Released).

The other two should´t be allowed to be selected so a fielderror is given. We will place the code in the ‘OnAfterValidate’ trigger and control every option from there.
The code looks as follows:

pageextension 50101 "SalesOrderExt" extends "Sales Order"
{
layout
{
modify(Status)
{
Editable = true;
trigger OnAfterValidate()
var
ReleaseSalesDoc: Codeunit "Release Sales Document";
begin
case Rec.Status of
Rec.Status::Released:
begin
ReleaseSalesDoc.PerformManualRelease(Rec);
CurrPage.SalesLines.PAGE.ClearTotalSalesHeader();
CurrPage.Update(true);
end;
Rec.Status::Open:
begin
ReleaseSalesDoc.PerformManualReopen(Rec);
CurrPage.SalesLines.PAGE.ClearTotalSalesHeader();
CurrPage.Update(true);
end;
Rec.Status::"Pending Approval":
Rec.FieldError(Status);
Rec.Status::"Pending Prepayment":
Rec.FieldError(Status);
end;
end;
}
}
}
Note that this is only modifying the sales order page. Other documents are unchanged so if you want this functionality for every document you need to create a page extension for each of them (Invoices, Credit Memos, Quotes, etc.).
Video test:
Hope you find it useful.