.NET event handling Server / Client callback error when opening page 41 / 42

Goonie
Member Posts: 7
Hi.
I really hope I formed the head of my question to make some sense.
I am very new to C/AL . The only things I know is from some specific googleing.
The problem is:
I have my own .NET assembly that selfhosts a simple WCF service, meaning that I can run an URL in a webbrowser e.g
http://localhost:8888/MessageService/ins766/SendMessageAndKey?Message=1002&Key=2
My service listenes for this URI and triggers an event.
This works ok as long as I only try to show a message box. But trying to open an order or quote , I get an error:
'Microsoft Dynamics NAV Application Server attempted to issue a client callback to run page 42 Sales Order. Client callbacks are not supported on Microsoft Dynamics NAV Application Server.'
The C/AL code looks like this:
Variables:
If I run the event from within the class using FireInTheHole method. It works just fine, and it can open a page.
Any thoughts are greatly appreciated
Best regards
Søren
I really hope I formed the head of my question to make some sense.
I am very new to C/AL . The only things I know is from some specific googleing.
The problem is:
I have my own .NET assembly that selfhosts a simple WCF service, meaning that I can run an URL in a webbrowser e.g
http://localhost:8888/MessageService/ins766/SendMessageAndKey?Message=1002&Key=2
My service listenes for this URI and triggers an event.
This works ok as long as I only try to show a message box. But trying to open an order or quote , I get an error:
'Microsoft Dynamics NAV Application Server attempted to issue a client callback to run page 42 Sales Order. Client callbacks are not supported on Microsoft Dynamics NAV Application Server.'
The C/AL code looks like this:
Variables:
Documentation() OnRun() NavEventHandler := NavEventHandler.NavHandler(); IF NavEventHandler.HostOpen THEN BEGIN MESSAGE('Host is running with URI: %1', NavEventHandler.BaseAddress.AbsoluteUri); END ELSE MESSAGE('Host is not running'); //Test fire from withing the class allows the page to be open: NavEventHandler.FireInTheHole(); NavEventHandler::ChangedEvent(recordId : Text;recordType : Integer) MESSAGE('Lookin for: %1 . Type: %2',recordId,recordType); saleRec."Document Type" := saleRec."Document Type"::Quote; saleRec."No." := recordId; saleRec.SETCURRENTKEY(saleRec."No."); IF saleRec.FIND('=') THEN BEGIN MESSAGE('I Found a/an : %1', saleRec."Document Type"); //orderPage.SETRECORD(saleRec); //orderPage.RUN(); END ELSE MESSAGE('now i Find a/an : %1', saleRec."Document Type"); NavEventHandler::LogEntried(logEntry : Text)
If I run the event from within the class using FireInTheHole method. It works just fine, and it can open a page.
Any thoughts are greatly appreciated

Best regards
Søren
0
Answers
-
Your error indicates that you have your NavEventHandler running in a Job Queue. If it does so, any interaction that involves UI will cause an error.
The MESSAGE dialog is handled a little bit different. When called from a Job Queue the message is logged in the Event Log of the server running your Service Tier.
You can use the keyword GUIALLOWED in your C/AL code to check if you're allowed to interact with the UI.1 -
Thanks for your answer Kasper.
Evaluating GUIALLOWED did show me, that the WCF hosts triggering the event returned false. But triggering it with FireInTheHole method is allowed
But any Idea why the NavEventHandler runs in a Job Queue ? And how to get it out of there ?
/Søren0 -
If it runs on the Job Queue, you would know. You have to set that up through the client.
It could also indicate that you run your DotNet variables on the server.
Did you set the RunOnClient property of your NavEventHandler variable to Yes?0 -
If I set RunOnClient to yes, then I'm not allowed to set withevents to yes. And I loose my events.
I have also tried to set class instances on a local variable to listen to the same event, But that yields an serilization error.
Decorating my .net class with [serilizable] didn't do any difference ...0 -
Thanks a lot for your input @kaspermoerch . I have boiled the issue down to a new more manageable question: forum.mibuso.com/discussion/67508/guiallowed-false-for-net-events-e-g-system-io-filesystemwatcher/p1?new=1
Br
Søren0
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