BUSINESS HOURS: 10.00 AM - 08.00 PM

AX 2012 Technical - Help with the DateTimeUtil Class

Problem Description

Need a bit of clarification on the DateTimeUtil Class and the questions are:

1. Some functionalities of client's product needs to store Date/Time to the 100 Nano seconds unit like the System.DateTime type. Is it possible to get this functionality in the utcDateTime?

2. The function datetime2str() you have thefollowing code:

// Start
utcDT = DateTimeUtil::utcNow();
// End

Assume that I live in Brussels, the company and user settings have the time zone set to GMT+1. I expect now that infolog prints me the local time, instead it prints the utc value without zone conversion. Any Ideas?

Thanks again! 

Solution to point#2

Can’t answer point1, but for point 2 they need to change the code like this:

utcDT = DateTimeUtil::applyTimeZoneOffset(DateTimeUtil::utcNow(), DateTimeUtil::getUserPreferredTimeZone());

Solution to point#1
Answering the first question. The utcdatetime type supports a minimum precision of 1 second. It is not possible to go to 100 nano second values. I would be very interested in knowing the partner’s scenario. You can share that with me offline if you can.

Best Response
I had no problem (except a little .NET interop weirdness w/int64) creating a table and storing high precision date/time values in it. Create a table called “TestDateTime” with two columns “str Description” and “int64 DateTimeInt” and run the following job to try it out:

static void DateTimeInTable(Args _args)
TestDateTime dtTable;

void SaveRec(str _description, str _datetimeStr)
System.DateTime dt;
int64 dtInt;

dtTable.Description = _description;
dt = System.DateTime::Parse(_datetimeStr);
dtInt = dt.ToBinary();
dtTable.DateTimeInt = dtInt;

void ShowRec(TestDateTime _rec)
System.DateTime datetime = System.DateTime::FromBinary(_rec.DateTimeInt);
str dtStr = datetime.ToString('o');

info(strfmt('%1=%2', _rec.Description, dtStr));

void ShowRecs(str _orderby)
next dtTable;

delete_from dtTable;

SaveRec('Rec 1','2009-01-01T12:12:12.1234567');
SaveRec('Rec 4','2009-02-01T12:12:12.1234567');
SaveRec('Rec 3','2009-06-01T12:12:12.1234567');
SaveRec('Rec 2','2009-01-02T12:12:12.1234567');

select nofetch dtTable order by Description;
ShowRecs('By Description');

select nofetch dtTable order by DateTimeInt;
ShowRecs('By DateTime');

AX 2012 Technical - Customizing workflow

Problem Description
I just got the following question regarding WF customization using X++ code. 
Any help is appreciated since case is old already:

We are designing a workflow which has variable number of approvals. Variable means number of approvals became clear after the workflow starts. 
Also the people that approvals are assigned to became clear at run-time according to a parameter. We need a workflow design that has variable number of approvals and variable assigned people. Could you help me how it can be done?

Thanks a lot for your help,

Maybe you can find useful information here:

Workflow Providers Overview

Walkthrough: Creating a Workflow Template

Walkthrough: Creating a Workflow with a Task and an Approval

Walkthrough: Adding Workflow to an Existing Form

AX 2012 Technical - Calling form modally disables few Help menu commands (Build

Problem:I am facing an issue when a form is opened modally, few commands in the help menu of the launched form are not responding (see figure below). But when I avoid using “true” value in the parameter of “wait()” method, all the commands in the help menu are working properly (but form will not open modally). It is requirement to disable the previous form or not allow modification in the parent form. I need to know whether is it something wrong with help menu framework? Is there any work around to call the form modally but the three commands in the Help menu should respond?

The method how the form is being called:-




Response#1 :

The way that the task (menu) system works is that the active form is given the first chance to process the task.
If it doesn’t handle the task, each form in its parent hierarchy is given a chance.
If the task is still not handled, the active workspace window is given the opportunity to handle the task.

I investigated what was happening with the “About Microsoft Dynamics AX” entry in the Help menu. I think what I found for that would apply to the other tasks (menu items) as well.
The task in question is defined in kernel code, and is identified by the constant CS_TASK_ABOUT (for the about box).

By setting a break point in the aboutBox task handler, and opening the form (non-modally) I was able to determine that the form itself is not handling this, and the tasks propagates up and is eventually handled by the workspace window.
When the form is opened modally, what I believe is happening is that when the task propagates up to the workspace window, it cannot be processed since that window is disabled. 

So if the expected behavior is that those menu items would continue to work (which I believe it is), a bug should be logged in the AX6 database under Client\Client\Workspace node.

I believe the reason maybe in general laws of windows behavior – Windows doesn’t allow non-modal form to popup from modal dialog. Help dialog is non-modal, so attempt to show it fails, probably exception is simply swallowed somewhere inside. So I think these items should be disabled. Alternatively (I did it in one project) the code that shows help-about form should first try it as non-modal; if this fails, it should open it as modal.

AX 2012 Functional - Able to attach the Invoiced Sales Order with Return order, but Batch number details are not carry forwarded to the Return order

Problem Description

I am trying to create return order with the following scenario:

Invoiced Sales Order with 
Item A with Batch Number 1000, 1001,1003 and 10007, Quantity 100
Item B with Batch Number X123,X125,X234 and X345, Quantity 200

I am able to attach the Invoiced Sales Order with Return order, but Batch number details are not carry forwarded to the Return order.

Is there any set-up is required…?

Any help is really appreciated.


We posted a Sales order where the item Batch number is attached 
then opened the return order form, selected the sales order and attached the disposition code.
this return order flows to the sales order form
The batch number will get carried forward for the returned item, if the disposition code is attached to the Returned order.

AX 2009 Functional - Creating BOM for a customer customizable lamp

Briefly speaking, a Bill of material (BOM) can be defined as the ingredients with their quantities needed to manufacture a product. It may have various levels of the components to make substructures with in the BOM of an overall refined product.

Our intention through this tutorial is to demonstrate a procedure where we could investigate the items required for manufacturing a product e.g. a lamp, consolidating these items on various levels and on the basis of quantities into a rough BOM description, and then finally creating this BOM into the ERP system like Dynamics Axapta 2009. So let's begin with understanding of BOM creation in Inventory management module. We have taken a scenario of customer customizable lamp because through using this scenario we want to discover as many options in AX as possible like in Production, Product Builder, Inventory Management, Sales Order, Purchase order modules. However, reader can choose any other scenario as the interest may be.

Page 1 of 3


Stay always updated with us. Sign in with our newsletter

Services Provided

  • D365FO Support
  • D365FO Customizations
  • SuiteCRM Implementation
  • Ticketing System Implementation
  • Website Development/Design
  • Odoo ERP Implementation