CodeBook - AX 2012 - Starting a process from within AX

 If you need to start a process from AX, like open a file with it's associated application, or open a URL, just use the .Net way:





public static client void startSomething()
{
    System.Diagnostics.Process process;
    System.Diagnostics.ProcessStartInfo startInfo;
    System.DateTime startTime;
    System.DateTime endTime;

    process = new System.Diagnostics.Process();

    // startTime = System.IO.File::GetLastWriteTimeUtc("a_file");
    startInfo = process.get_StartInfo();
    startInfo.set_FileName("path_to_your_file");
    startInfo.set_Arguments(strfmt('\"%1\"', configFile));
    process.Start();
    process.WaitForExit();
    // endTime = System.IO.File::GetLastWriteTimeUtc("a file");
}

No comments:

Post a Comment