web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Unable to Launch an external application from AX 7

(0) ShareShare
ReportReport
Posted on by 60

Hi,

I have a requirement to launch an external application which is an executable file (The .exe file has some UI like word etc.,) from a button click in AX 7. I have tried using the below 2 statements but  could not make it work

1) WinAPI::shellExecute("C:\\cr3\\cr3\\cr3.exe");

---This caused an exception -> "Function 'ShellExecuteExW' in DLL library 'C:\windows\system32\SHELL32.dll' has caused an exception."

2) System.Diagnostics.Process process;
System.Diagnostics.ProcessStartInfo processStartInfo;

new InteropPermission(InteropKind::ClrInterop).assert();

processStartInfo = new System.Diagnostics.ProcessStartInfo("C:\\cr3\\cr3\\cr3.exe");
process = new System.Diagnostics.Process();

process.set_StartInfo(processStartInfo);
process.Start();

---This executes without any errors but it does not show any window or the external application which was launched.

Any corrections/suggestions how to make this work in AX 7.

*This post is locked for comments

I have the same question (0)
  • Martin Dráb Profile Picture
    239,029 Most Valuable Professional on at

    Using System.Diagnostics.Process is the right approach if you want to start an application from the web server. But if you expect to see some window on client, it seems you want to start something on the local machine, which is a different problem. Note that X++ always executes on server and web browsers generally don't have permissions to do things like starting other applications.

  • Suggested answer
    Vilmos Kintera Profile Picture
    46,149 on at

    Dynamics 365 for Operations is now a server-side application, so your code would attempt to run something in an IIS session on your AX AOS which is obviously not going to work.

    You may try something like this:

    http://stackoverflow.com/questions/20192576/how-to-run-an-executable-from-the-browser

  • Ajay kumar Pollamsetty Profile Picture
    60 on at

    Hi Vilmos,

    I tried java script approach but had hard luck.

    I tried to use below 2 java script functions and tried to call them on button click() of a custom extension control

    <script>

    function myFunction1() {

         var oShell = new ActiveXObject("Shell.Application");

         var commandtoRun = "start C:\\cr3\\cr3\\cr3.exe";

         // Invoke the execute method.

         oShell.ShellExecute(commandtoRun, "", "", "open", "1");

    }

    function myFunction2 {

       WshShell = new ActiveXObject("WScript.Shell");

       WshShell.Run("C:/cr3/cr3/cr3.exe", 1, false);

    }

    </script>

    But I am struck with these error--->

    --------------------------

    ReferenceError: ActiveXObject is not defined
    at RunFile (eval at globalEval (usnconeboxax1aos.cloud.onebox.dynamics.com/.../jquery-2.1.4.min.js:2:2538), <anonymous>:9:20)

    --------------------------

    Moreover I tried creating hyper link and a button as shown below to call the exe file. But it did not show any mercy.

    <p><a href="file://c:/cr3bat.bat">launch2</a></p>

    <p><input type="button" value="launch3" onclick="window.open('file:///c:/cr3bat.bat')" /></p>

    May be as Martin said, It is not possible now to launch a local executable file from AX7 due to browser security and due to lack of proper permission to execute local exe file. If it works somehow, it may be browser specific as i understand. A common way to work in all browsers might not be possible.

    If the conclusion is "Its impossible" -> this topic will be closed for discussion

    But if there are any workarounds/ any different approach , Please comment here so that I can give a try.

    Thanks for your replies.

  • Martin Dráb Profile Picture
    239,029 Most Valuable Professional on at

    If you say "I want to execute any arbitrary exe file from browser without user's content", the answer is that you can't.

    We could suggest a different approach, but first you have to tell us what business requirement you're trying to implement. So far you talked about how you decided to implement it, not what.

  • Ajay kumar Pollamsetty Profile Picture
    60 on at

    Hi Martin,

    The requirement is simple as I mentioned in the beginning. I need to run the exe file present in the local drive (imagine like a portable application which runs without any installation) which typically takes a single parameter. It is similar to calling an exe file with a parameter from the command prompt. While running the exe file if the browser issues any security warning and ask for user confirmation to open the file, user clicks yes and application should open.

    2017_2D00_03_2D00_18_5F00_0753.png

  • Martin Dráb Profile Picture
    239,029 Most Valuable Professional on at

    My point is: why do you want to run an exe file? What business problem are you trying to solve by this technical solution?

  • Ajay kumar Pollamsetty Profile Picture
    60 on at

    The application contains some drawings related to an item in production. So the user want to refer these drawings for the item at any time in the production process. So we will be passing item id as the parameter to this application which will show the relevant drawings for the item.

  • Suggested answer
    Vilmos Kintera Profile Picture
    46,149 on at

    Martin got the point correctly, running an external application from a browser to display an item image is not the correct approach. You may add images for released products using standard functionality. Also you can use Document attachment where images, document could be attached to almost any records in AX.

    Handling images from a technical point of view:

    ax.help.dynamics.com/.../using-images-on-your-form-on-in-a-grid

    File handling:

    dev.goshoom.net/.../file-upload-and-download-in-ax-7

    community.dynamics.com/.../how-to-work-with-files-in-ax-7-part-1-upload-download-read-and-store-files-in-db

    community.dynamics.com/.../how-to-work-with-files-in-ax-7-part-2-browse-and-download-files-stored-in-db-attach-files-to-the-new-document-management

  • Ajay kumar Pollamsetty Profile Picture
    60 on at

    AX document handling does not solve the purpose here because once the images are uploaded in document handling, If there is any design change in the product drawing, user have to delete the previous upload and attach the new image again or at least they have to upload new one again. I am sure customer won't prefer AX document handling for this purpose. They have all the full capabilities to create, modify, maintain drawings of all products to its finest level in the external application and they are used to this in their business.

  • Vilmos Kintera Profile Picture
    46,149 on at

    Then I guess your only option is to try to implement the solution proposed on external websites. AX cannot cover your feature request by default.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Joris dG Profile Picture

Joris dG 5

#2
Alexey Lekanov Profile Picture

Alexey Lekanov 2

#2
Henrik Nordlöf Profile Picture

Henrik Nordlöf 2 User Group Leader

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans