Tuesday, November 24, 2020

Build model through command line

Reference: (source) -> https://www.theaxapta.com/2020/11/build-model-through-command-line.html 

Get List of all workspace

tf.exe workspaces /owner:* /computer:{Workspace} /collection:https://{TFS}.visualstudio.com

Delete a workspace

tf workspace /server:https://{TFS}.visualstudio.com/defaultcollection /delete "{Workspace};{Owner}"

You need to out email id of the owner, user id will not work.

compile model

C:\AosService\PackagesLocalDirectory\Bin\Xppc.exe -verbose -apixref -metadata=C:\AosService\PackagesLocalDirectory -modelmodule=<model_name> -referenceFolder=C:\AosService\PackagesLocalDirectory -xreffilename="C:\AosService\PackagesLocalDirectory\<model_name>\<model_name>.xref" -refPath=C:\AosService\PackagesLocalDirectory\<model_name>\bin -output=C:\AosService\PackagesLocalDirectory\<model_name>\bin -log=C:\<log_path>\Dynamics.AX.<model_name>.xppc.log -xmllog=C:\<log_path>\Dynamics.AX.<model_name>.xppc.xml

compile model best practices

C:\AosService\PackagesLocalDirectory\Bin\xppbp.exe -metadata=C:\AosService\PackagesLocalDirectory -packagesRoot=C:\AosService\PackagesLocalDirectory -module=<model_name> -model=<model_name> -all -log=C:\<log_path>\Dynamics.AX.<model_name>.xppbp.log -xmllog=C:\<log_path>\Dynamics.AX.<model_name>.xppbp.xml

compile labels

C:\AosService\PackagesLocalDirectory\Bin\LabelC.exe -metadata=C:\AosService\PackagesLocalDirectory -modelmodule=<model_name> -output=C:\AosService\PackagesLocalDirectory\<model_name>\Resources\ -outlog=C:\<log_path>\Dynamics.AX.<model_name>.labelc.log -errlog=C:\<log_path>\Dynamics.AX.<model_name>.labelc.err

compile reports

C:\AosService\PackagesLocalDirectory\Bin\ReportsC.exe -metadata=C:\AosService\PackagesLocalDirectory -modelmodule=<model_name> -LabelsPath=C:\AosService\PackagesLocalDirectory -output=C:\AosService\PackagesLocalDirectory\<model_name>\Reports\ -log=C:\<log_path>\Dynamics.AX.<model_name>.reportsc.log -xmllog=C:\<log_path>\Dynamics.AX.<model_name>.reportsc.xml

sync db

C:\AosService\PackagesLocalDirectory\Bin\SyncEngine.exe -syncmode=fullall -metadatabinaries=C:\AosService\PackagesLocalDirectory -connect="Data Source=ERP-BL-D-APP-1;Initial Catalog=AxDB;Integrated Security=True;Enlist=True;Application Name=SyncEngine" -fallbacktonative=False -raiseDataEntityViewSyncNotification

Monday, November 23, 2020

Reserve and Unreserve Sales order line X++ D365FO

Code for reserve and unreserved  sales order lines

Inputs: SalesLine, InventDim (Combination to reserve), Qty

Note

To Reserve -> Pass Qty as negative

To Unreserved -> Pass Qty as positive

Code:

InventMovement         movement;

movement = inventTrans::findTransId(_salesLine.InventTransId).inventMovement(true); 

InventUpd_Reservation   reservation;

 reservation  = InventUpd_Reservation::newInventDim(movement, _inventDim, _qty, false);

reservation.updateNow();

PO Registration X++ D365FO

Code to do registration through X++

Note: To do reverse registration provide input qty as Negative, otherwise to add new registration then qty must be positive.

private void inventTransactionRegister( InventTransId    _inventTransId, 

                                            Qty     _qty, 

                                            InventBatchSerialId   _batchNo = '', 

                                            InventBatchSerialId   _serialNo = '') 

    {

        InventTransWMS_Register     inventTransWMS_register;

        TmpInventTransWMS           tmpInventTransWMS;

        InventDim                   inventDim;

        InventTrans                 inventTrans = InventTrans::findTransId(_inventTransId);

        boolean                     ret;

        //inventTransWMS_register = inventTransWMS_register::newStandard(tmpInventTransWMS);

        inventDim               = inventTrans.inventDim();


        InventSerial    inventSerial;

        InventBatch     inventBatch;


        tmpInventTransWMS.clear();

        tmpInventTransWMS.ItemId = inventTrans.ItemId;

        tmpInventTransWMS.initFromInventTrans(inventTrans);

        tmpInventTransWMS.InventQty   = _qty;

        if(_batchNo && 

                this.checkTrackingDimensionEnabledItem(inventTrans.ItemId, fieldNum(InventDim, InventBatchId)))

        {

            inventBatch = InventBatch::findOrCreate(_batchNo, inventTrans.ItemId);

            inventDim.inventBatchId = inventBatch.inventBatchId;

        }

        if(_serialNo && 

                this.checkTrackingDimensionEnabledItem(inventTrans.ItemId, fieldNum(InventDim, InventSerialId)))

        {

            inventSerial = InventSerial::findOrCreate(_serialNo, inventTrans.ItemId);

            inventDim.inventSerialId = inventSerial.InventSerialId;

        }

        tmpInventTransWMS.InventDimId = inventDim::findOrCreate(inventDim).inventDimId;

        tmpInventTransWMS.insert();

inventTransWMS_register = inventTransWMS_register::newStandard(tmpInventTransWMS);

        ret = inventTransWMS_register.writeTmpInventTransWMS(tmpInventTransWMS,

                                                        inventTrans,

                                                        inventTrans.inventDim());

        if(ret)

        {

            inventTransWMS_register.updateInvent(inventTrans);

        }


}

Copy Markup charges while posting purchase invoice using X++

 Copy Markup charges while posting purchase invoice using X++ Class: Important: Code logic is just for Reference.  New class => Duplicate...