Coding tips (for partners)

Add custom fields to the VAPS

In addition to the default fields available in tooltip, label, and table text, it is possible to equip custom fields with data to use them in tooltip, bar label, and table text.

By creating a simulation in the VAPS, the Dynamics 365 BC data tables (containing the necessary data for the visualization) are copied automatically into the extension one to one as so-called SIM (Simulation) data tables and from there are taken to be visualized in the VAPS. This means that every scheduling action or modification you carry out in the VAPS first impacts the simulation data and only when you press the "Save" button the data will be written back to BC. 

These Dynamics 365 BC data tables copied into SIM data tables are

  • Production Order =>"NETVAPS SIMPrdOrdr"
  • Production Order Line => "NETVAPS SIMPrdOrdrLn"
  • Production Order Routing Line => "NETVAPS SIMPrdOrdrRtngLn"
  • Sales Order Number => "NETVAPS SIMSalesOrdrHeader"
  • Sales Line Item Number = > "NETVAPS SIMSalesOrdrLine"
  • Work Center Group => "NETVAPS SIMWrkCntrGrp"
  • Work Center => "NETVAPS SIMWrkCntr"
  • Machine Center =>"NETVAPS SIMMchnCntr"

So if you want to have additional data fields showing in tooltip, label or table text, you have to create 

  1. a table extension for adding the field to the BC table
  2. a table extension for adding the field to the SIM table
  3. if necessary: a page extension for populating the field with data
  • The BC table extension

The extension for the BC table adds the custom data field to the BC table:

tableextension 60001 POBCExt extends "Production Order"

{

    fields

    {

        field(60000; "CustomField"; Code[20])

        {

            DataClassification = CustomerContent;

        }

    }

}
  • The simulation table extension

With this extension, the custom field you have added to the BC table gets added to the SIM table accordingly . 

Please note that the data fields numbers have to be identical.

tableextension 60000 POLExt extends "NETVAPS SIMPrdOrdr"

{

    fields

    {

        field(60000; "CustomField"; Code[20])

        {

            DataClassification = CustomerContent;

        }

    }

}
  • Population of the BC data field by page extension

Once your field is created it needs to be filled with values. This can be done either by code or by a page extension like shown below:

pageextension 60002 "ProdOrder" extends "Firm Planned Prod. Order"

{

    layout

    {

        addlast(General)

        {

            field("CustomField"; "CustomField")

            {

                ApplicationArea = All;

            }

        }

    }

How to proceed

Step 1

  • Open Visual Studio Code and add a new project with a new al. file. 
  • Create the extension(s) you need like described above.  Please note that the two data fields must have the same id. 

Step 2

The file app.json should contain the dependency for the VAPS:

  "dependencies": [

        {

      "appId": "26fb6f9e-04f2-47c1-863e-9725fcdc9784",

      "name": "Visual Advanced Production Scheduler",

      "publisher": "NETRONIC Software GmbH",

      "version": "x.x.x.x"

    }

Step 3

Publish your extensions and the newly added data field will be listed in the configuration for tooltip, label or table text.

 

Result