Run external program with job queue
 
            
                
                    luninaut                
                
                    Member Posts: 3                
            
                        
            
                    Hi,
we recently updated to NAV 2016. I am currently looking for a way to run an external program (Zip program with password encryption).
Please respect the following conditions:
- Transfer of parameters at called program
- Program should be executed by a job queue
- Program should always run on the server (so that you can restart the job queue entry manually, no installation of the program on all clients)
I've tried the dotNet type System.Diagnostics.Process.System so far, but when running on the job queue it comes to the error message that a client callback of the function is not supported (ProcessShell: = ProcessShell.Process;).
And with a 'Windows Script Host Object Model'.WshShell the program seems to be executed only on the client computer.
Maybe someone else has an idea how to implement such a constellation under the 3-tier architecture. I'm grateful for every hint.
                we recently updated to NAV 2016. I am currently looking for a way to run an external program (Zip program with password encryption).
Please respect the following conditions:
- Transfer of parameters at called program
- Program should be executed by a job queue
- Program should always run on the server (so that you can restart the job queue entry manually, no installation of the program on all clients)
I've tried the dotNet type System.Diagnostics.Process.System so far, but when running on the job queue it comes to the error message that a client callback of the function is not supported (ProcessShell: = ProcessShell.Process;).
And with a 'Windows Script Host Object Model'.WshShell the program seems to be executed only on the client computer.
Maybe someone else has an idea how to implement such a constellation under the 3-tier architecture. I'm grateful for every hint.
0                
            Best Answer
- 
            Finally we got the solution. The missing hint was, that we had to set the property RunOnClient=No for the ProcessShell variable.0
Answers
- 
            Hi.
 You can run an external program by the following code:ProcessShell.Start(FileName,Arguments) 0
- 
            Thank you for your answer. I already tried following code.ProcessShell := ProcessShell.Process; ProcessShell.StartInfo.UseShellExecute := FALSE; ProcessShell.StartInfo.FileName := Path.Path + '7z'; ProcessShell.StartInfo.Arguments := 'u -tzip -mem=AES256 -p' + Password + ' ' + ZipFileName + ' ' + FileToZip; ProcessShell.StartInfo.CreateNoWindow := TRUE; ProcessShell.Start(); ProcessShell.WaitForExit(600000); CLEAR(ProcessShell); 
 But the dubugger stops at the first line with error message "Client callbacks are not supported on Microsoft Dynamics NAV Business Web Services." when running the codeunit in a job queue.
 It runs fine when I start the codeunit manually.
 0
- 
            Finally we got the solution. The missing hint was, that we had to set the property RunOnClient=No for the ProcessShell variable.0
- 
            Hi Luninaut,
 The property of ProcessShell variable is probably set to RunOnClient Yes. So in case of a webservice call you can define an other variable ProcessShell2 set To RunOnClient No.IF CURRENTCLIENTTYPE = CLIENTTYPE::SOAP THEN BEGIN ProcessShell2 := ProcessShell.Process; ProcessShell2.StartInfo.UseShellExecute := FALSE; ProcessShell2.StartInfo.FileName := Path.Path + '7z'; ProcessShell2.StartInfo.Arguments := 'u -tzip -mem=AES256 -p' + Password + ' ' + ZipFileName + ' ' + FileToZip; ProcessShell2.StartInfo.CreateNoWindow := TRUE; ProcessShell2.Start(); ProcessShell2.WaitForExit(600000); CLEAR(ProcessShell2); END ELSE BEGIN ProcessShell := ProcessShell.Process; ProcessShell.StartInfo.UseShellExecute := FALSE; ProcessShell.StartInfo.FileName := Path.Path + '7z'; ProcessShell.StartInfo.Arguments := 'u -tzip -mem=AES256 -p' + Password + ' ' + ZipFileName + ' ' + FileToZip; ProcessShell.StartInfo.CreateNoWindow := TRUE; ProcessShell.Start(); ProcessShell.WaitForExit(600000); CLEAR(ProcessShell); END; 0
- 
            Instead if coming to a conclusion like RunOnClient=No this works, I hope you too understood why it works. Thanks Thanks
 Blog - rockwithnav.wordpress.com/
 Twitter - https://twitter.com/RockwithNav
 Facebook - https://facebook.com/rockwithnav/0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 323 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions


