Tuesday, November 26, 2013

AX 2012 how to get new number using Number Sequence

Question:

How to get new number in AX 2012 using Number Sequence

Answer:

NumberSeq num;
num = NumberSeq::newGetNum(RetailParametersEx2::numSLInternalRequisitionNumber());

AX 2012 Get Current Worker Id

Question:
How to get Current Worker Id in Dynamics AX 2012

Answer:
HcmWorkerRecId workerRecId = DirPersonUser::currentWorker();

Thursday, November 21, 2013

Debugging Enterprise Portal code in AX 2009/2012

File open dialog on AX 2012 form

Problem:
I want to show a file open dialog on AX 2012 form but when I click the open dialog button it doesn't respond.

Solution:
On Runbase OR Sys operations framework, all you have to do is set the EDT to FileNameOpen and dialog will appear, however, on AX form only setting the EDT will not do. You will need to add following methods to your form methods node.

str filenameLookupFileName()
{
    return "";
}

FilenameFilter filenameLookupFilter()
{
    return ["@SYS134052", #AllFilesName+#AllFilesExt];
}

str filenameLookupInitialPath()
{
    return "";
}

str filenameLookupTitle()
{
    return "Select a trade agreement to import";
}