Open Forum

Expand all | Collapse all

noob Developer Persisting table extension

  • 1.  noob Developer Persisting table extension

    Posted 20 days ago
    Hi all

    brand new to D365 BC and getting my feet wet with dev (worked with many other ERP's)

    Anyway, I want to extend the Sales Header table with two fields (and later add a new table). Fo rnow, I just want to add the two fields (ints), enter values and persist them.

    Here's my code: I see the fields, can enter data, but when I re-open the record, the values are zero again

    tableextension 50103 "SalesOrderHeader Ext" extends "Sales Header"
    {
    fields
    {
    field(50103; "Load No"; Integer)
    {

    }

    field(50104; "Load Sequence"; Integer)
    {

    }
    }
    }

    pageextension 50103 "SaleOrderHeader Ext" extends "Sales Order"
    {
    layout
    {
    // Add changes to page layout here
    addLast("Shipping and Billing")


    {
    field("LoadNo"; "Load No")
    {
    // ApplicationArea sets the application area that
    // applies to the page field and action controls.
    // Setting the property to All means that the control
    // will always appear in the user interface.
    ApplicationArea = All;
    }
    field(LoadSeq; "Load Sequence")
    {
    ApplicationArea = All;
    }

    }
    }


    what do i need to do to persist the values?


    on a side note, how do i add these to a filter in, for example, if I want filter by Load Sequence in "Home/Sales Orders/Ready To Ship:, how would I make these new fileds visible?

    TIA

    Mark

    ------------------------------
    Mark Anderson
    Clesen Wholesale
    Evanston IL
    ------------------------------


  • 2.  RE: noob Developer Persisting table extension

    GOLD CONTRIBUTOR
    Posted 20 days ago
    First, I'll cover persistence.

    In BC, you have to go out of your way to *not* persist data. You'd have to declare a record variable with the property temporary added:

          SalesHeader: Record "Sales Header" temporary;

    So I don't think that is what is going on. It might have to do with declaring what type of data the new fields are, which was added recently in order to support GDPR requirements. Anyway - try this:

    field(50103; "Load No"; Integer)
    {
      Caption = 'Load No.';
      DataClassification = CustomerContent;
    }

    You can also eliminate the page as being the source of the problem by running the table directly in the web browser URL, and see (a) do your new fields show up and (b) did they keep the data:

    https://whatever.server.bc365/InstanceName/?Table=36

    As for filtering the list, that is going to be another Page besides Sales Order (Page 42). I do not have a D365 account, so I'm looking at BC on premise, but if I go to Home / Sales Orders / Ready To Ship, that brings up Page 9305 Sales Order List, so extend that page the same way you did Sales Order. Then you can filter on those new fields just like any other field shown.

    ------------------------------
    Kyle Hardin
    NAV Developer
    ArcherPoint Inc.
    Duluth GA
    ------------------------------



  • 3.  RE: noob Developer Persisting table extension

    TOP CONTRIBUTOR
    Posted 20 days ago
    Also check the SchemaUpdateMode property in your launch.json file. It should be set to Synchronize. If it is Recreate it will wipe out all of the data for your extension when you deploy a new version.

    ------------------------------
    Matt Traxinger
    NAV Developer
    ArcherPoint Inc.
    San Antonio TX
    ------------------------------



  • 4.  RE: noob Developer Persisting table extension

    Posted 19 days ago
    Thanks Kyle

    works now. not sure if I changed anything that would have caused it to start working

    ------------------------------
    Mark Anderson
    Clesen Wholesale
    Evanston IL
    ------------------------------



If you've found this thread useful, dive deeper into User Group community content by role