This post is machine-translated. The original post in german language can be found here.

Start production order through code

Screenshot

Dynamics AX provides a framework, which can be used to update production orders to a specific status. In the example, a production order is started.

If you want to update several production orders at the same time, you must invoke the ProdMultiStartUp.insert() method per production order and pass the respective record of ProdTable.

 

static void prodStartUp(Args _args)
{
    ProdTable prodTable;
    ProdMultiStartUp prodMultiStartUp;

    prodTable = ProdTable::find("P000160");

    prodMultiStartUp = ProdMultiStartUp::construct(new Args());
    RunBaseMultiParm::initParm(prodMultiStartUp);
    prodMultiStartUp.insert(prodTable, prodMultiStartUp.defaultParmBuffer());

    prodMultiStartUp.run();
}
 

If you want to override the Default parameters, you may use the following peace of code as an example:

static void prodStartUpModifyParams(Args _args)
{
    ProdTable prodTable;
    ProdMultiStartUp prodMultiStartUp;
    ProdParmStartUp prodParmStartUp;
    ProdParmStartUp prodParmStartUpUpd;

    ttsbegin;
    prodTable = ProdTable::find("P000160");

    prodMultiStartUp = ProdMultiStartUp::construct(new Args());
    RunBaseMultiParm::initParm(prodMultiStartUp);

    prodParmStartUp= prodMultiStartUp.defaultParmBuffer();

    prodMultiStartUp.insert(prodTable, prodParmStartUp);

    // Overwrite parameters using hardcoded settings
    prodParmStartUpUpd = ProdParmStartUp::find(prodParmStartUp.ParmId, prodParmStartUp.ProdId, true);
    prodParmStartUpUpd.RouteAutoConsump = RouteAutoConsump::Never;
    prodParmStartUpUpd.bomAutoConsump   = BOMAutoConsump::Never;
    prodParmStartUpUpd.update();

    prodMultiStartUp.run();
    ttscommit;
}
 
These post applies to following version:
Dynamics AX 2012

 
 

 

 
 
 
Posts of the actual month
April 2025
MoTuWeThFrSaSu
 123456
78910111213
14151617181920
21222324252627
282930 
 
© 2006-2025 Heinz Schweda | Imprint | Contact | German version | Mobile version
In order to provide you with better service, this site uses cookies. By continuing to browse the site, you are agreeing to our use of cookies.