Using StartSession

rickyl76
Member Posts: 25
Is it possible to capture an error that may have been generated by using StartSession? In my example i want to raise a sales order in another company based on a trigger. If, say the customer was blocked in the company that startsession was used, is there a way i can get the last error and save it somewhere? By using a return value on Startsession it just seems to indicate that the startsession was successful. In my instance the startsession was successful but what it tried to do wasn't.
0
Answers
-
The startsession just indicates that the new Background session was started successfully. Since the newly created session runs asynchronously errors in the background session cannot be retrieved using the return value.
Therefore you must log the Error in the context of the background session. Instead ofStartSession(CreateSalesOrderCodeunit,...)
you could tryStartSession(CodeunitRunner,....)
where CodeunitRunner is it's own Codeunit doing nothing butif not CreateSalesOrderCodeunit.Run() then SomeLogFunction(GetLastError());
Austrian NAV/BC Dev0
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