How to Publish AX Reports for a specific AOS Instance

DAX Knowledge Pot

If you are running multiple instances of AX on a single environment, you have more than likely gone through the instructions as per this URL

One of the steps identified in this URL talks about publishing reports using the following AX Powershell command: publish-axreports.

What isn’t perhaps obvious from the examples shown on the Deploy reports to the new Reporting Services Instance [AX 2012] page is – How do I publish reports for a specific AOS instance? (The examples shown is for the default instance)


When you look at the full syntax of the Publish-AxReports powershell command:


You will notice two optional parameters that are of interest, namely:

  • ServicesAOSName
  • ServicesAOSWSDLPort


These two parameters are used to “tell” the Publish-AXReports powershell command, which AOS to connect to when publishing reports.

The syntax used for these two parameters are as follow:

  • ServicesAOSName

    This parameter contains the name…

View original post 89 more words

Powershell command to deploy SSRS reports AX 2012

You have to run Power shell Management Shell as Administrator.

1) $reports = Get-AXReport -ReportName *

This power shell scripts helps to get the list of Dynamics Ax 2012 SSRS reports available for deployment.

2) We can also filter the list of report . Dynamics Ax 2012 provide the only two filter options Report Name and changed date. You can use following statement.

$Reports | Select-object Name, ChangedDate

For example if we want all reports similar to ABC classification we can filter something like this

$Reports | Select-object Name, ChangedDate | where { $_.Name -like “ABC*” }

3) If we want to deploy a single requierd report we have to use following statement.

Publish-AxReport -Id SSRSConfigId -ReportName CustTransList

SSRSConfigID will be the machine name.

4) If we have to deploy all reports then we can use following statement.

Publish-AXReport –Id SSRSConfigID –ReportName *

5) Above statement also works if we did not use SSRSConfigID.

Publish-AXReport –ReportName *

Page Break at Nth row in SSRS Report

Page break at nth row in SSRS AX 2012.

SQL Server Rider

We can design a SSRS report with a constraint of only N rows per page. It will be interesting if I explain this with an example.


Report developer get a request from team lead saying… Design a simple report with table component and display all rows available in a table x. But, you should show only 10 rows per page in the SSRS report. PS: I am expecting this report to be done with in 15 mins.

The brave report developer just design a report by pulling data to the report without our the 10 rows per page constraint.

I will be showing you that how to display only N rows in the report in this article.


Design a report as described in the article. This implementation topic has page break configuration in the report.

Step 1: A simple design to show all rows in a table using table…

View original post 121 more words

Ledger Transactions Import – AX 2012


, , , , ,

static void LedgerTransImport(Args _args)


    Voucher                         voucherNum;












    LedgerJournalName   ledgerJournalName;

    LedgerJournalTable  ledgerJournalTable;

    LedgerJournalTrans  ledgerJournalTrans;




         ledgerJournalName = LedgerJournalName::find(#Name);

         if (ledgerJournalName)


            //Journal header





            ledgerJournalTable.JournalNum = NumberSeq::newGetNum(LedgerParameters::numRefJournalNum()).num();

            //ledgerJournalTable.JournalNum = NumberSeq::newGetNum(LedgerParameters::numRefJournalNum()).num();

            ledgerJournalTable.Name = #Description;

             if (ledgerJournalTable.validateWrite())



                 //Journal line



                 ledgerJournalTrans.JournalNum = ledgerJournalTable.JournalNum;

                ledgerJournalTrans.TransDate = systemDateGet();

                voucherNum = new JournalVoucherNum(JournalTableData::newTable(ledgerJournalTable)).getNew(false);

               ledgerJournalTrans.Voucher = #Voucher;

               ledgerJournalTrans.Voucher      = voucherNum;

                ledgerJournalTrans.AccountType = LedgerJournalACType::Ledger;


                [strFmt(“%1-%2-%3”, #Account, #BusinessUnit, #Department),

                #Account, 2, “BusinessUnit”, #BusinessUnit, “Department”, #Department]));

                ledgerJournalTrans.OffsetAccountType = LedgerJournalACType::Ledger;


                [strFmt(“%1-%2-%3-%4-%5”, #OffsetAccount, #BusinessUnit, #Department, #CostCenter, #ItemGroup),

                #OffsetAccount, 4, “BusinessUnit”, #BusinessUnit, “Department”, #Department, “CostCenter”, #CostCenter, “ItemGroup”, #ItemGroup]));

                 ledgerJournalTrans.Txt = #Text;

                 ledgerJournalTrans.CurrencyCode = #Currency;

                ledgerJournalTrans.AmountCurDebit = #Debit;

                ledgerJournalTrans.AmountCurCredit = #Credit;

                 if (ledgerJournalTrans.validateWrite())





                    throw error(“Journal line”);



                throw error(“Journal header”);



            throw error(“Journal name”);










SSRS report with RDP framework

Suppose I have a requirement where I have to show data related to one sales id.

Step 1) Create a query SampleSalesTableQuery with SalesTable as datasource and create a temp table with name SampleSalesTmpTable;

Step 2) Create contract class.


public class SampleSalesContract
RecId recordId;


public RecId parmRecordId(RecId _recordId = recordId)
recordId = _recordId;
return recordId;


Step 3) Create controller class


public class SampleSalesController extends SrsReportRunController

SampleSalesContract contract;

SalesTable                 sTable;


protected void preRunModifyContract()

contract = this.parmReportContract().parmRdpContract() as SampleSalesContract;

sTable = this.parmArgs().record();



public static void main(Args _args)
SampleSalesController  formLetterController = new SampleSalesController();



Step 4) Create DP class.


public class NTT_FakturPajakDP extends SRSReportDataProviderBase

RecId                                                  salesRecId;

SampleSalesTmpTable                       salesTmpTable;



public SampleSalesTmpTable getSampleSalesTmpTable()
select salesTmpTable;
return salesTmpTable;

private void insertSalesTableTmp()

//write code to insert data into temp table.


public void processReport()

SampleSalesContract      contract;

Query      q;

QueryRun   qr;

q = new Query(queryStr(SampleSalesTableQuery));

contract = this.parmDataContract() as SampleSalesContract;

salesRecId = contract.parmRecordId();

q.dataSourceTable(tablenum(SalesTable)).addRange(fieldnum(SalesTable, RecId)).value(queryValue(salesRecId));

qr = new QueryRun(q);






Button enable-disable on Listpageform in AX 2012


, , ,

Hi All,

Today one of my friend asked me how to do the button enable disable on the form based on the condition of the records . I simply said that either you write it active method or there must be some class written where you have to do the change. Later I found out that it is a listpageform (SalesTableListPage). Most of the new comers dont know how to accomplish such task.

Let me give you small demo how to do it.

I will use the same form (SalesTableListPage) on action pane “Sales Order”, after attachent button, I have to add a button named “Run”.

If the order type is returned then this button should get enabled.

Now if we look at the properties of the form, we can see that class used here is “SalesTableListPageInteraction”. There might be different ways to accomplish this task. I will explain one of them.

Step 1) First I created a button named “RunFormButton” on the form and set the autodeclaration property to yes.

Step 2) There is a method named “selectionChanged()”, here there is a line 

                salesTable = this.currentSalesTable();

                after this line we have the buffer of salesTable, hence we are going to write our code after this.

Step 3) Create new method named setButtonRun(boolean  _run)

             protected void setButtonRun(boolean  _run)


                        this.listPage().actionPaneControlEnabled(formControlStr(SalesTableListPage, RunFormButton), _run);


Step 4) In selectionChanged method find the below code

                   salesTable = this.currentSalesTable();

                after this line we have the buffer of salesTable, add following code into it.

                 if (salesTable.SalesType == SalesType::ReturnItem)









Step 5) Run the form and enjoy 🙂

Debug BP errors in Dynamics AX 2012

Hi all,

Very interesting topic it is. 

With Dynamics AX 2012, some new BP errors have been introduced. Often, while fixing BP errors, I turn to the List of Best Practice Error and Warning Messages page on MSDN for help.

But what if you are getting a BP error and there is no clear description on how to fix it. In such scenarios, I always debug the BP error and try to see what is causing this BP error in the first place.

This guy explained it very well, please follow the below link. please  click on the below link or copy and paste in URL to read it in details.


Menstrual taboos and ancient wisdom

Sorry to share non-ax content, but this is worth it…..

Mythri Speaks

“Why am I not allowed to visit a temple during my period?”A student sharing her experience

“Will the pickle really spoil if I touched it during menstruation?”

“Akka, why do they tell us not to touch anyone, to sit in a separate room and eat from a separate plate when we get our period?

Two thoughts play hide and seek in my mind as I try to answer these questions from young girls. One, that I should help them understand that these restrictions are not because they become impure or polluted during menstruation. Two, that I should never, ever, hurt their religious or cultural sentiments beacuse I have neither the knowledge nor the right to make that judgement. The latter makes it difficult to do the former, and so round and round I go in my explanations, at best being able to tell them that these practises have been in place for ages to…

View original post 2,477 more words