Detecting RunTime Enviroment in NAV

‘In the beginning’ life was easy. All C/AL-code was executed on the C/AL-client.

When the NAS came with Navision Financials 2.65, there was no command to determin if C/AL was executed on the NAS. On the other hand, could the NAS only be run in Application-mode, so logging was made to the console.

The command ‘GUIALLOWED’ was introduced with MBS Navision Attain 3.01.
Finaly we could execute code depending on current runtime engine.

Running NASRunning NASRunning NAS

With the new 3-tier setup introduced with NAV 2009 this was not enought anymore since code now could be executed on the servicetier.
Then¬†command ‘ISSERVICETIER’ was introduced, to allow the programmer to do special code if the user was running RTC.

Running RTC-code

With NAV 2009 Microsoft also introduces native webservices.

What if a fileimport is exposed as a webservice method in NAV?


As a webservice cannot interact with the user, any fileimport must be done from a fileshare (\\TierServer\Imports\) accessable from the ServiceTier.
Since the webservice-call is executed on the ServiceTier, we could use the command ‘ISSERVICETIER’.

Great! but wait… What if the same fileimport is also run by a user on RTC?

The sollution is to combine the commands ‘GUIALLOWED’ and ‘ISSERVICETIER’ as in the example below.

Run webservice code.

Explore posts in the same categories: Runtime, Webservice

Comment:

*
To prove you're a person (not a spam script), type the security text shown in the picture. Click here to regenerate some new text.
Click to hear an audio file of the anti-spam word