Posts

Showing posts from February, 2021

EVENT HANDLING IN D365

Image
Event Handler Methods in Dynamics 365 for operations is the preferred mechanism for customizations to existing objects by using event handlers to react to various events rather than overriding methods on tables, forms, and classes. In our case, we want to perform an action on the ‘ OnClicked ’ event. We want to disable an existing control on the form, by creating a new control and whenever this control is checked the existing control is disabled.   ·         Extensions Creating purchase order form and its main data source table extensions. Adding A field in Table Extension Add a new field in the extension table named IsInvoiceable and type NoYes enum. Adding new control in form design: Create a new group and inside that group a new check box. Now copy the OnClicked event of the newly created check box   ·         Handler class Now we need a handler class to add the changes we want. we add our lo...

Form Extension Framework in D365 on Purchase Order Form

Image
  Implementing form extension framework in D365 on Purchase Order form As we know that we don’t make any changes in the already present functionalities of dynamics. So, we created extensions to achieve our changes. Let’s say, we want to add a filter on all purchase orders so that it only shows those orders which are either open order or received . We need to check first the data source and the field it is bind with.   ·         Form Extension Creating purchase order form extension.  As we know that QueryExecuted is always called on the Parent data source. We are working on an extension, so we need to work on Event handlers. Depending on our needs we can decide whether to use OnQueryExecuted or OnQueryExecuting .   OnQueryExecuting runs before the super() call of the event OnQueryExecuted runs after the super() call of the event   We need to add our range before the query execution, so we need to work on ...

Complex or Advance Query Ranges - D365

Image
Complex or Advance Query Ranges  using null, enum, expressions  in D365 I came across the requirement to add custom ranges on query which cannot be handled by using the simple query add range method. So, I used query expressions to add range on query according to the requirement. Below are some ways to use advance or complex query ranges. We can pass values in query ranges by using strfmt so that %1 gets the value of X and %2 gets the value of Y. To get complete compile-time stability, use intrinsic functions to return the correct field names, as shown in the following code example. strFmt('((%1 == %2) || (%3 == %4))', fieldStr(MyTable, A), x, fieldStr(MyTable, B), y)   Comparing with null: We can use strfmt (%1 = = ‘ ‘) but instead it is better to use empty string function of SYSQUERY ; qbrDate.value(strFmt('(%1 != %2)’ ), fieldStr(InventTrans, DateInvent), SysQuery::valueEmptyString()); Comparing with somevalue: We there are many functions of  ...

Dynamic grouping for inventory dimension on SSRS Report in AX12 using query builder

Image
We usually see the inventory dimensions selection criteria while running several inventory reports. I  just  went through the requirement where we needed to group on dimensions dynamically based on the selection.  Different approaches can be used. I used query builder classes. L et’s say a user wants to split data on site, warehouse and batch number for the item Below is the code which is getting a sum of quantity from the inventory transaction table for the items .        Query                 inventTransQuery = new Query();     QueryBuildRange       dynRange;     QueryBuildDataSource  qbdsInvent, qbdsDim;         inventTransQuery.clearAllFields();       qbdsInvent  = inventTransQuery.addDataSource( tableNum (InventTrans));     qbdsDim     = qbdsInvent.addDa...

SSRS Report Query changes are not reflecting in Dynamics AX.

Image
    I recently encountered an issue where I modified a query on a report but it still showing the previous query instead of new one. Here are some steps which refresh the system caches, so it starts showing the modified output.       First check that u saved the changes and compiled it before running      Cleaning cache a.        Tools ---  cache b.        Tools ---  options--- usage data Services Startmenu ---  All programs ---  Services Select service which is responsible for SSRS reporting. i.e. SQLServerReportingServices and click restart. Visual studio a.        Refresh the report dataset. b.        Deploy report Open the properties window of DP_DynamicParameter and check its AOT query, it should have the latest query attached. Then deploy it.    1.        Comma...