Run codeunit

lubost
Member Posts: 633
We need to run specific codeunit (OnRun trigger) and stop session afterwards from Windows Task scheduler. Our issues:
- for logged user client shows message to confirm connection (-consolemode parameter doesn't help)
- for not logged user codeunit isn't invoked. Event viewer reports unspecified error - probably concerning confirm connection message
- STOPSESSION command in our codeunit stop session, but shows unwanted message
Our codeunit doesn't need user interaction and interafce.
We need run this codeunit independently to other running NAV services. We use MS Dynamics NAV 2017 environment.
Any suggestion will help.
Thanks in advance
- for logged user client shows message to confirm connection (-consolemode parameter doesn't help)
- for not logged user codeunit isn't invoked. Event viewer reports unspecified error - probably concerning confirm connection message
- STOPSESSION command in our codeunit stop session, but shows unwanted message
Our codeunit doesn't need user interaction and interafce.
We need run this codeunit independently to other running NAV services. We use MS Dynamics NAV 2017 environment.
Any suggestion will help.
Thanks in advance
0
Answers
-
Can you use the Job Queue or TASKSCHEDULER.CREATETASK instead from within NAV?
What do you mean by "logged" user? The user must be registeres as a NAV user and must have permission within NAV to access, whatever your codeunit accesses. This is true regardless of how you try to run the codeunit.0 -
Thanks for response,
Task Scheduler can be configured to invoke task not depending to user is logged on machine.0 -
Although you may set up a task in Windows scheduled tasks, you cannot run any NAV business logic without beeing authenicated with NAV. If you don't want to use a Windows user for running your codeunit, you need to set up an NST with a different authentication scheme and still create a NAV user.
I don't know if it is possible (and advisible) to supply full credentitials on the command line in order to use e.g. the user + password authentication scheme. I guess, the only option you have then is a call to a Web Service.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
- 320 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