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:
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
Answers
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.
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øren
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?
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 ...
Br
Søren