Wednesday, 29 November 2017

Develop Gantt chart in AX7 / D365

Development of gantt chart is little difficult in AX7 / D365. It is an extremely powerful way to present data. In AX7 / D365 Microsoft have licensed a third party HTML5 control that gives gantt chart control a new design.


The standard Gantt chart is available for Production resources in AX7 / D365 as shown below:
For one my development task I need to develop gantt chart. When I see Source Code, behind Production resources, I found it very difficult to understand (for new developers). So what I have done is I have developed a gantt chart with simplified code as shown in below images that can help developers to code easily for gantt chart.












Understand Date and Time with Timezone

I have came across a scenerio in which I want to pass current system date & time, But when I use DateTimeUtil::getSystemDateTime() it shows me wrong time as per my requirement. So after some research I found out that this issue is happening because of timezone. So when I provide time zone it returns right date and time as shown in below images.

Timezone enumeration can also be seen in MSDN documentation:
Timezone System Enumeration AX2012, AX7 & D365





Tuesday, 28 November 2017

Batch job in AX7 / D365 x++ code

In AX7 / D365 batch jobs are created pretty same as we did in AX2012. Below mention is the code snippets that shows how to create a batch class.




After that all we need to do is to create Action menu item and assign class name in its object property and set Object type to Class. That is all you need to do for creating a batch job.

Thursday, 23 November 2017

EDT Array Elements in Dynamics AX2012 & AX7 / D365

In AX2012 or AX7 / D365, we have a feature of an extended data type in the Application Object Tree (AOT) that contains multiple elements. This enables you to store multiple data elements in a single field that is based on this extended data type. Typically this is done by creating an extended data type (EDT) that is an array type, and then using the EDT as the type for a field in a table. 

When I work for one of my projects in dynamics, I have a scenario in which user wants to see multiple sales orders, based on some conditions in grid. 
So on that point I have two options:
1- I should create 100 columns in my table. Or;
2- I should create a single edt containing 100 array elements.
As per good programming practice & more effective architectural design
I used option No 2. Which is shown in below image. It is more easy to handle and
more suitable.

Create EDT with Array Elements: (Sales Id Type)


Add EDT in Table:


When you add your table as datasource in Form. It creates array elements as fields.






Wednesday, 22 November 2017

Release to warehouse functionality through Job X++ code

Release to warehouse in AX2012 & AX7 / D365

I have came across a scenario in which I need to run release to warehouse functionality through code, I have done some research over internet but cannot find any relevant code or solution to achieve my goal. So after some debugging & research in Dynamics AX, I am now able to run release to warehouse functionality through code. Below is the code that gives exact result as same as clicking Release to warehouse button on Sales Order Screen. This code is feasible for both AX2012 & AX7 / D365.
Note: Both the images is of the same method.


Functional understanding of Release to Warehouse:
Release to warehouse lets the picking operations at the warehouse floor commence.
On clicking release to warehouse button below mention is the flow.

Flow:
- A load is created and the corresponding order lines added to it
- A wave is created (manually or automatically), and the load lines associated with it
- The wave is released (manually or automatically):
      - The allocation of inventory to pick happens, and work lines are created with the locations to pick from determined by the location directives.
- A pre-requisite depending on the AX release (CU) you have is that the inventory on sales order lines is  reserved.
- Optional steps during wave release are replenishment and containerization - extra work to move goods from bulk area to pick area and a process for packing your picked items into containers of the defined type for shipping.

Monday, 20 November 2017

AX7 / D365 – How to debug batch jobs

Debugging

Sometimes we need to debug certain batch job execution. In AX 2012 we have to attached Visual Studio to the 'AOS' process and debug the IL code. It's pretty much the same still and got even easier because X++ now is a .NET language. 

So navigate to Debug / Attach To Process in Visual Studio and make sure to select show processes from all users. The batch service has the obvious name Batch.exe (its location is C:\CustomerServiceUnit\DOBind\Packages\Cloud\AosWebApplication\
AosWebApplication.csx\roles\AosWeb\approot\bin – at least on locally deployed machines and this is only for informational purposes, usually you won’t need to know). 

Attach to that process and be able to debug the X++ code that is executed there.


Vendor collaboration management in AX7 / D365

In this blog I will demonstrate how to create vendor user and create purchase orders to be shown in vendor collaboration.


Vendor user creation in Dynamics 365:


Create Primary contact on vendor using navigation shown below.


 
Create user and assign the following roles on user.















Purchase order creation:

Create Purchase order of your vendor, add lines and confirm the Purchase order.


Now login from newly created user and navigate the following location.



At this stage user can see its open and confirmed purchase order which be shown under vendor collaboration section.





Friday, 17 November 2017

Access data from AX7 / D365 Event Handlers:

Access Form Controls In Form’s Method Pre / Post Event Handlers:


Access Form Controls In Form’s Datasource Event Handlers:


Access Form Controls In Form’s Control Event Handlers:




Access Form Controls In Class Method Event Handlers:



Rest of the control can be access the same way as mention above.

Thursday, 16 November 2017

Setup database Log in D365 / AX7

Setup and use of Database Log in AX7/D365 works pretty much in the same way as in AX2012.

Database Log setup

The setup is done under System administration > Setup > Database log setup.

Press +New to create a new Database log.




This opens a Wizard that will guide you through the setup process.





Find the table and field you want to setup data. In this document I want to setup the database log for the search name (Item) field on the Product Master.



The relevant field is found under Trade > Products > Search Name
Select the field Search Name and press Next in the bottom right corner of the page.



Since you only select one field on the customer record, you can only select "Update".



Press Next to continue and Finish to complete the setup.
The Database Log setup for the Search Name field on the Products is now added to the setup database logs.



That is how we can setup database log. For testing change search name on a product master
Go to Product information management > Products > Product masters.

Select the product master where the search name value must be updated and press Edit.

Change the value to "TEST" and press Save to save the change than access to the Database log from the record through action pane on the customer record or list page select Option > Record info.

Action pane with Record information opens in the right side of the page. Select the menu item "Database log". This gives you direct access to the database log for the specific record. 

Select Action pane "History". You can see that User "Admin" has change the search name. As same in AX2012 we have access to the same information from System administration > Inquiries > Database log.

How to Get Customer Free Text Invoice "Totals" form field value with X++ in D365FO

Customer free text invoices are an essential aspect of financial management in D365FO. In this blog, I have compiled all the code needed to ...