Wednesday, October 21, 2020

Select the batch tab in dialog by default using SysOperation in Ax 2012 X++


Hi guys, Today we see how to select the batch tab in dialog by default using SysOperation in Ax 2012 using X++.

In my Contract class I am not using any EDT. When I run Controller class the Dialog is Open with Empty general Tab. Like Below image.



For Avoiding this

Write Below method in Controller Class:

 protected void dialogPostRun()

{
    sysOperationDialog sysOperationDialog;
    DialogTabPage batchTab;
    FormRun formRun;

    super();

    sysOperationDialog = this.dialog() as SysOperationDialog;

    formRun = sysOperationDialog.formRun();

    batchTab = sysOperationDialog.batchDialogTabPage();

    formRun.selectControl(batchTab.control());
}

OutPut:




Keep Daxing!!

Refresh DataSource and retain to same position in Ax 2012 X++

 

Hi guys, Today we see when I run execute query I don't want to change active record cursor position in ax 2012 X++.Refresh DataSource and retain to same position.

Here we have 2 ways Just check below.

Code 1:  Here we use Get and Set methods.

    Int         position;

    position = TestTable_ds.getPosition();

   TestTable_ds.executeQuery();

    TestTable_ds.setPosition(position);


Code 2:  we can use Recid also. This is more efficient compared Code 1.

    TestTable    testTable;

    testTable.RecId = TestTable.RecId;

    TestTable_ds.executeQuery();

    TestTable_ds.findRecord(testTable); 


Keep Daxing!!


How to get Product Variants in AX 2012 X++


Hi guys, Today we see how to get product variants in Ax 2012 using X++.

Run the below code.


static void getProductVariants(Args _args) 

{

InventDimCombination inventDimCombination;
InventDim                     inventDim;

while select inventDimCombination

   where inventDimCombination.ItemId == 'D0006'

      join inventDim

          where inventDim.inventDimId == inventDimCombination.InventDimId

  {

      info(strFmt('%1 : %2 : %3 : %4 : %5',

             inventDimCombination.DistinctProductVariant,

             inventDim.configId,

             inventDim.InventColorId,

             inventDim.InventSizeId,

             inventDim.InventStyleId));     

  }

Keep Daxing!!

Tuesday, October 20, 2020

Delete Product Master in Ax 2012 X++


 Hi guys , Today we see how to delete product master from Ax 2012 using X++


Run the below code.This code delete only Product master Not its Product dimensions and product variants.


static void deleteProduct(Args _args) 

{

    InventTable         inventTable;

    EcoResProduct           ecoResProduct;

 

   inventTable = InventTable::find('D0006',true);

   ecoResProduct = EcoResProduct::find(inventTable.Product, true);

   inventTable.delete();

   if (ecoResProduct.validateDelete())

   {

       ecoResProduct.delete();

   } 

}


Keep Daxing!!

Friday, October 9, 2020

Customization Analysis Report In D365 F & O

 Hi guys, Today we see how to create CAR (Customization Analysis Report) in D365 F & O.


                                The Customization Analysis Report is a tool that analyzes your customization and extension models, and runs a predefined set of best practice rules. The report is one of the requirements of the solution certification process. The report is in the form of a Microsoft Excel workbook.

Source Link


Open the Command Prompt (Run as administrator).

Change path:

CD .. -->previous folder

CD K: -->Change to k drive

k: --> Again write it

//CD k:\AOSService\PackagesLocalDirectory\Bin

cd AosService\PackagesLocalDirectory


Note : Paste Xppbp cmd if mot found navigate to bin folder


K:\AosService\PackagesLocalDirectory>cd bin


Standard Example:

                xppbp.exe -metadata=<local packages folder> -all -model=<ModelName> -xmlLog=C:\BPCheckLogcd.xml -module=<PackageName> -car=<reportlocation>

Run the below Command

xppbp.exe -metadata=k:\AosService\PackagesLocalDirectory -all -model="MYModel" -xmlLog=C:\Temp\BPCheckLogcd.xml -module="TestCase" -car=C:\Temp\CustomizationAnalysisReport_Foundation.xlsx

Made changes as per your model and package.


Keep Daxing!!