Running batch file from X++ and uploading the file to FTP server!


I am generating a file with some data about invoices and saving it in the network location as a *.csv file. There is a software vendor on the other side, which wants me to upload the generated file to his FTP server. So, how can we do this?

Step by step.

  1. I have already created the mentioned *.csv file. Let’s say, it has been placed in \\example\path\, so our full path is: \\example\path\07_02_2019.csv
  2. The second step is to create a batch file, which will be executed from X++ code. Everything about creating a connection with FTP server and uploading created file will be here. So this *.bat file is…

    • …using WinSCP to connect with FTP server,
    • …logging all actions in the upload.log file,
    • …setting proper directory and uploading file.

  3. Now we can execute out a *.bat file from X++ code in Microsoft Dynamics AX. So…

  4. Done! 🏆 Our file is now uploaded!

If you think that there is a better way to solve this problem, please send me an email through „Contact” form or leave a comment, I will keep this post updated!

Dodaj komentarz