Dynamics Search Engine

Thursday, June 14, 2012

How to use Windows File Path Dialog in Microsoft Dynamics® AX 2012

How to use Windows File Path Dialog in Microsoft Dynamics® AX 2012


Applied on:
Microsoft Dynamics® AX 2012 CU2.

Assumption:
This article is for those who has at least basic data flow, navigation and programming
knowledge of Dynamics® AX.

About this article:
This article may answers your question like-
In Microsoft Dynamics® AX 2012 how to call Windows File Path Dialog?
How to use Windows File Path Dialog in X++ language?
How to call WinAPI from Dynamics AX using X++ language?
How to take file path input from user?


I have written a job mentioned below which shows how to use Windows File Path Dialog with New Folder button option.


static void CallWinFilePathDialog(Args _args)
{
    FilePath filepath; // To hold path value
    filepath = WinAPI::browseForFolderDialog("Description goes here", "Selected path goes here", true);
    info(FilePath); // To Display
    // Here you can use your TableName.FieldName = filepath to store the value.
}

The above code execution displays below dialog:



You can create a button called Browse and implement above code to its clicked method.