Knowledge Base - Cloud Connect

Run BOM Route Generator using X++ Code

The Experlogix BOM Route Generator (BRG) model in Microsoft Dynamics 365 F&O provides an easy-to-use logic to run the BOM Route Generator process for a single line for both Sales Order Lines and Sales Quotation Lines. This topic provides details for running the BOM Route Generator in Microsoft Dynamics 365 F&O using the X++ Code.

Run BRG using X++ code

  1. In the XplBOMROUGeneration class, in the Main method, create an Args object.

  2. Set its record to Line, either a sales line or a quote line.

  3. Call the main method, passing the Args object into it.

  4. Provide the linked item config record where the status of the BOM Route generator process for this line (in this company) can be checked.

This findLinked static method is in table XplBrgItemConfig.

The following code snippet illustrates the above steps.

public static void main(Args _args)

    {
        //required: a record - either a sales order line or a sales quotation line
        SalesLine       salesLine;

        salesLine = SalesLine::find('000810');

        _args.record(salesLine);

        //have an Args object available with the record set to the line

        //run bom route generation for this line - it is a transaction for the entire process for this single line

        XplBOMROUGeneration::main(_args);

        //to check the status of the processing action, read the linked XplBrgItemConfig record and check the fields

        //processed, processedBy, processedDateTime and ProcessedCompanyId

        //this process writes errors and informational messages to the info log as well

        XplBrgItemConfig    itemConfig = XplBrgItemConfig::findLinked(salesLine); //this retrieves the linked item config record

    }

If code similar to this is implemented in a separate AX model, please add the following models as dependencies:

  • Application Platform

  • Application Suite

  • Experlogix Integrator

  • Experlogix BomRouteGenerator.