Month: July 2014

Purchase order Price refresh popup


When quantity of a saved purchase order line is changed, currently AX automatically refreshes the unit price and discounts as per current data. This causes original unit prices being overwritten with prices applicable for current period. Final result is when supplier produces the invoice, mismatches between ordered amount and Invoice amount.

When we initially change the Quantity in PO line, the popup wont appear, but when we change the Unit price once and modify the Quantity again the popup will appear. The main logic for this popup written at \Data Dictionary\Tables\PurchLine\Methods\modifiedField :line 48.

So in order to achieve same functionality when creating PO line and changing the Quanity values, written same logic at \Data Dictionary\Tables\PurchLine\Methods\validateField

In order to get the popup we need to have the record in “PriceDiscPurchPolicyParameters” table.

This table will hold all the values of the Enum : “PriceDiscPurchasePromptSystemSource”. By default it will have all the records of Enum values but as we created the new Enum value for this change we need to create record in the table level.



Filtering data in SSRS Query


Below is the sample code written to filter the data based on Query used by report and apply on custom query in DP class;

//DP class


//Get filtered/selected value from standard query 
qrOrderAccount = queryVendInvoiceJour.dataSourceName(‘VendInvoiceJour’).rangeField(fieldNum(VendInvoiceJour,OrderAccount));

//Writing custom query based on requirement but applying the selected ranges to custom query

q=new Query();
qbdsVendInvoiceJour = q.addDataSource(tablenum(VendTrans));
qrVendInvoiceJour = qbdsVendInvoiceJour.addRange(fieldNum(VendTrans,AccountNum));

qr = new QueryRun(q);


This will help to overwrite the Query used in Report using the custom query by applying same ranges selected by user.