NAS posting codeunit 90, returns false

Mauddib
Member Posts: 269
I will make up a scenario here to simpify the issue im having...
I have a report which calls a function in a codeunit. The report is scheduled to run with the NAS once a day.
In the codeunit the function posts purchase orders by doing some processing then saying:
IF LUnitPurchPost.RUN(LRecPOHead) THEN BEGIN
//Some happy code here
END ELSE BEGIN
//Some unhappy code here
END;
(LUnitPurchPost is codeunit 90. Whenever I run the report manually all is good. However whenever the NAS runs it it always goes into the unhappy code. I can't see why. I've even logged in as the same user the nas uses to log in and posts POs manually to ensure they don't have errors there (permissions etc).
I have a report which calls a function in a codeunit. The report is scheduled to run with the NAS once a day.
In the codeunit the function posts purchase orders by doing some processing then saying:
IF LUnitPurchPost.RUN(LRecPOHead) THEN BEGIN
//Some happy code here
END ELSE BEGIN
//Some unhappy code here
END;
(LUnitPurchPost is codeunit 90. Whenever I run the report manually all is good. However whenever the NAS runs it it always goes into the unhappy code. I can't see why. I've even logged in as the same user the nas uses to log in and posts POs manually to ensure they don't have errors there (permissions etc).
0
Comments
-
Hello Mauddib
Run the codeunit without the if statement and check the event log and you'll see error. Most likely reason is window.open('. You need to write if GUIALLOWED then window.open,
window.update and window.close in CU 90.0 -
Its not a window.open or update. I checked for this in codeunit 90. In fact I turned on code coverage and posted one of the purchase orders and checked ALL the code, even code not in codeunit 90, to see if any dialouges were called anywhere that shouldnt be. But there is nothing.
Its seemingly inexplicable. Whenever I run my process manually it works a charm, but when run via the nas user it sometimes doesnt. Whenever it fails I can see the PO it failed on but if i go and manually post that po it works fine.0 -
remove the error catching process. So that it errors out in NAS and then check the event log.0
-
Also I have a similar problem . Have you solved it? How?
Thank you0 -
check if you have somewhere a dialog (to disable dialog when NAS runs the codeunit use GUIALLOWED before the Dialog) and check also the permissions of the NAS user. If you think all is fine, start the codeunit from NAS without the if codeunit.run. Use Codeunit.run() (without the if XXXX then). So the erroe will be written in the eventlog and you can see the reason. Also you can debug the NAS viewtopic.php?f=23&t=25967
Don't forgett, when you start the debugger on NAS the NAs runs with your windowslogin. so set before your windowslogin the same permissions like the originen NAS user or Start the NAS debug with the NAS WindowsLogin (Logon on Windows with the NAS account)
RegardsDo you make it right, it works too!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