web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Answered

How can the due date field be filtered like posting date?

(0) ShareShare
ReportReport
Posted on by 40

Hi, everyone

This is the field I added to the AL code

pastedimage1680849736889v1.png

But there is no way to use filtering.

How can the due date field be filtered like posting date?

Thank you!

I have the same question (0)
  • Suggested answer
    NAV_with_Narang Profile Picture
    2,294 Moderator on at
    RE: How can the due date field be filtered like posting date?

    Seems like you may have erroneously specified a TableRelation for your Due Date field, can you please share your AL code snipped for this custom field?

  • Hsuan Hung Profile Picture
    40 on at
    RE: How can the due date field be filtered like posting date?

    tableextension 50102 due_date extends "Warehouse Shipment Header"

    {

       fields

       {

           field(50151; "Due Date"; Date)

           {

               Caption = 'Due Date';

               DataClassification = ToBeClassified;

               Editable = false;

               TableRelation = "Warehouse Shipment Line"."Due Date";

           }

       }

    }

    ---------------------------------------------------------------------------------------------------------

    pageextension 50203 WarehouseShipment extends "Warehouse Shipment"

    {

       layout

       {

           addafter(Status)

           {

               field("Due Date"; REC."Due Date")

               {

                   /*ApplicationArea = All;*/

               }

           }

       }

       trigger OnAfterGetRecord()

       begin

           updateDueDate()

       end;

       trigger OnOpenPage()

       begin

           updateDueDate();

       end;

       local procedure updateDueDate()

       var

           WarehouseShipmentLine: Record "Warehouse Shipment Line";

       begin

           Clear(rec."Due Date");

           WarehouseShipmentLine.Reset();

           WarehouseShipmentLine.SetRange("No.", REC."No.");

           if WarehouseShipmentLine.FindSet() then

               rec."Due Date" := WarehouseShipmentLine."Due Date";

       END;

       var

           "Due Date": Date;

           Pos: Integer;

    }

    -------------------------------------------------------------------------------------------------

    Thanks!

  • Suggested answer
    Nitin Verma Profile Picture
    21,698 Moderator on at
    RE: How can the due date field be filtered like posting date?

    Hi,

    You can remove the Table relation property from this field in Header Table and then try again.

    Thanks.

  • Suggested answer
    Gianfranco C. Profile Picture
    370 on at
    RE: How can the due date field be filtered like posting date?

    hi, try this code in AL :

    2843.pastedimage1680852864173v1.png

    Moreover, your code would not work correctly:

    the update of the due date would always be based on the due date of the first shipment line found.

    what is your goal?

    Don't forget to help the community by Verifying the answer and Like it if your question has been answered. It will let others know that the topic has verified answer.

    Thanks & Regards,  Gian

  • Hsuan Hung Profile Picture
    40 on at
    RE: How can the due date field be filtered like posting date?

    Thanks!

    But at present, the due date field will no longer display Table relation, but it still cannot be filtered.

    pastedimage1680853733337v1.png

    pastedimage1680853856014v2.png

  • Suggested answer
    Nitin Verma Profile Picture
    21,698 Moderator on at
    RE: How can the due date field be filtered like posting date?

    Hi Disable this code first and then try again

    trigger OnAfterGetRecord()

      begin

          updateDueDate()

      end;

  • Gianfranco C. Profile Picture
    370 on at
    RE: How can the due date field be filtered like posting date?

    temporarily comment out the calls to the procedure updateDueDate and try again.
    I think the procedure code is not correct for your purpose.

    (Can you explain what you would like to do)

  • Hsuan Hung Profile Picture
    40 on at
    RE: How can the due date field be filtered like posting date?

    After removing the code,

    the due date field will no longer display data.

    pastedimage1680854635789v1.png

  • Suggested answer
    Nitin Verma Profile Picture
    21,698 Moderator on at
    RE: How can the due date field be filtered like posting date?

    As I said, remove the code only from OnAfterGetRecords and be it on OnOpenpage and then try again.

  • Hsuan Hung Profile Picture
    40 on at
    RE: How can the due date field be filtered like posting date?

    Our actual delivery date is the due date field, so I want to filter out the WS to be shipped on that day.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 3,377

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 2,696 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,512 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans