Inkey Solution Logo
banner

Blogs

Set Shipment Date Blank When Creating A New Sales Order In Business Central Using AL Code

, October 17, 2023 731 Views

Business Central is a powerful Enterprise Resource Planning (ERP) solution that offers a wide range of customization options to meet the unique needs of your business. One such customization is to set the shipment date as blank when creating a new sales order in Business Central. This customization can be particularly useful when you want to allow manual entry of the shipment date and prevent the system from automatically populating this field. So lets see how we can set shipment date blank when creating a new sales order in Business Central using AL code.

Requirement:

We recently received a request to customize the shipment date when creating a new sales order, with the goal of preventing the automatic population of the shipment date provided by Business Central.

Prerequisites:

  • Access to a Dynamics 365 Business Central instance with administrator privileges.
  • Basic knowledge of AL (Application Language) code.
  • Visual Studio Code with AL Language extension installed.

Solution (Implementation Steps):

To accomplish this customization, we will use AL code in Microsoft Dynamics 365 Business Central. Specifically, we will create a codeunit to handle the initialization of the sales order record and allow for manual input of the shipment date.

Step 1: Create a New AL Codeunit

  • In the Visual Studio Code, create a new AL codeunit.
  • Inside the codeunit, you can subscribe to the “OnInitRecordOnBeforeAssignShipmentDate” event to customize shipment date. You can do this by using the “[EventSubscriber]” attribute.
codeunit 50101 INK_ShipmentDate_SalesOrder
{
    [EventSubscriber(ObjectType::Table, 36, 'OnInitRecordOnBeforeAssignShipmentDate', '', false, false)]
    local procedure OnInitRecordOnBeforeAssignShipmentDate(var SalesHeader: Record "Sales Header"; var IsHandled: Boolean)
    begin
        IsHandled := true;
    end;
}

Step 2: Publish and Install the Extension

After creating the codeunit, you’ll need to publish and install the extension in your Dynamics 365 Business Central instance.

Step 3: Test the Customization

  • With the extension installed, go to your Dynamics 365 Business Central instance and create sales order.
  • When you create a new sales order, you should notice that the shipment date field is now blank instead of automatically populating with the default value provided by Business Central.
  • Test the customization thoroughly to ensure it works as expected and meets your business requirements

Output:

Set Blank Shipment Date in Business Central using AL Code

Conclusion:

In conclusion, by following the steps outlined above, you can successfully customize the shipment date behavior when creating new sales orders in Microsoft Dynamics 365 Business Central using AL code. This customization allows you to have greater control over the shipment date field and prevents it from being automatically populated. This can be a valuable feature for businesses that require manual entry of shipment dates or have specific requirements around this data point. This customization empowers businesses to tailor their ERP system to meet their unique needs and ensures that the system aligns with their specific sales order management processes.


ATM Inspection PowerApp to ease ATM inspection and report generation process.
https://www.inkeysolutions.com/microsoft-power-platform/power-app/atm-inspection

Insert data into Many-to-Many relationship in Dynamics CRM very easily & quickly, using the Drag and drop listbox.
http://www.inkeysolutions.com/what-we-do/dynamicscrmaddons/drag-and-drop-listbox

Comply your Lead, Contact, and User entities of D365 CRM with GDPR compliance using the GDPR add-on.
https://www.inkeysolutions.com/microsoft-dynamics-365/dynamicscrmaddons/gdpr

Create a personal / system view in Dynamics CRM with all the fields on the form/s which you select for a particular entity using the View Creator.
http://www.inkeysolutions.com/what-we-do/dynamicscrmaddons/view-creator

Admin

More posts by

Leave a Reply

Your email address will not be published. Required fields are marked *

The maximum upload file size: 2 MB. You can upload: image, audio, video, document, spreadsheet, interactive, text, archive, code, other. Drop file here

Would you like to digitize your business and put it on the cloud?
Do you need clear, concise reports for your organization?