1

i want to execute a .exe in a SSRS Report from Microsoft Dynamics AX.

I tried so far to realize that over Custom Code and a Textfield with following Expression: =Code.StartProcess("test")

Public Function StartProcess(ByVal s As String) As String  
  Dim pHelp As New ProcessStartInfo
  pHelp.FileName = "test.bat"
  pHelp.Arguments = s
  pHelp.UseShellExecute = True
  pHelp.WindowStyle = ProcessWindowStyle.Normal
  Dim proc As Process = Process.Start(pHelp)
  Return "it works"
End Function 

I get the error ":StartProcess is invalid. InvalidIdentifier"

As second try i use this:

="javascript:void(window.open('file://AX2012R2A/Share/batch.exe'))"

in an action expression.

This trial opened in the report the following message by clicking on the image: enter image description here

My problem is now that I have to pass a parameter to the batch and then it doesn't work.

Have you any idea to help me?

Jonathan Bravetti
  • 2,228
  • 2
  • 15
  • 29
JamesnxD
  • 153
  • 1
  • 14

1 Answers1

0

I have solved my Problem.

As first step I mentioned, that also simple methods like:

Public Function StartProcess(ByVal s As String) As String   
  Return "it works"
End Function

brought the error: ":StartProcess is invalid. InvalidIdentifier"

As second step i found this link: Link to Google Group discussion (perhabs you have to expand all messages).

As last step i have to create a Datamethod and then call it in an expression and it works. The code in the datamethod isn't in VB.Net but in C#. How this works, can you see here (Youtube)

Thank you all for your help.

JamesnxD
  • 153
  • 1
  • 14
  • 1
    Could you include the main parts of the content you linked to in your answer. These links may become invalid at some point and it would be nice if future readers of your answer could still use it then. – FH-Inway Sep 21 '16 at 01:03
  • Of course, give me some time this afternoon and i will edit my post :) – JamesnxD Sep 22 '16 at 07:34