Check windows client’s execution mode at runtime

If you want to check if the windows client is run in config mode at runtime, then there is an easy method to do that:

// variablesEnv : DotNet : System.Environment.'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'cmdArgs : DotNet : System.Array.'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'// codecmdArgs := Env.GetCommandLineArgs;IF LOWERCASE(FORMAT(cmdArgs.GetValue(1))) = '-configure' THEN  // do something

Method GetCommandLineArgs gives back a string array. In the sample it’s expected, that the -configure parameter is the first parameter. To check all parameters you can do with that code:

FOR i := 0 TO cmdArgs.Length - 1 DO  IF LOWERCASE(FORMAT(cmdArgs.GetValue(i))) = '-configure' THENMESSAGE('Config mode');

There is an alternative method, also working, but much longer and with low performance. 😉

// variablescmdLine : Text; // codecmdLine := LOWERCASE(GetCmdLine);IF (STRPOS(cmdLine, '-configure') <> 0) OR (STRPOS(cmdLine, '/configure') <> 0) THEN  Message('Config mode');PROCEDURE GetCmdLine : Text;// variablesFileMgt : Codeunit 419CurrProc : DotNet "'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.Diagnostics.Process"MgmtObjSearcher : DotNet "'System.Management, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.System.Management.ManagementObjectSearcher"MgmtObjColl : DotNet "'System.Management, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.System.Management.ManagementObjectCollection"MgmtObj : DotNet "'System.Management, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.System.Management.ManagementObject"Enum : DotNet "'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.Collections.IDictionaryEnumerator"cmdLine : Text;// codeCurrProc := CurrProc.GetCurrentProcess;MgmtObjSearcher := MgmtObjSearcher.ManagementObjectSearcher(  STRSUBSTNO('SELECT CommandLine FROM Win32_Process WHERE ProcessId = %1', CurrProc.Id));MgmtObjColl := MgmtObjSearcher.Get;Enum := MgmtObjColl.GetEnumerator;WHILE Enum.MoveNext DO BEGIN  MgmtObj := Enum.Current;  cmdLine += STRSUBSTNO(' %1', MgmtObj.Item('CommandLine'));END;EXIT(cmdLine);

cheers

NAV 2017 ready for download

Just checked partnersource. NAV 2017 first release is ready for download on partnersource. Great thing! Seems that there are more new features developed for the web client. A.i.k. the windows client will not be continued, what can be a reason.

A complete “What’s new list” you’ll find here.

  • Office 365 Experience
  • Embedded Power-BI
  • Better/Easier Setup and Configuration, Setup wizards
  • Notifications for the Web Client
  • Explorer like lists with thumbnails
  • Finance Enhancements: Default Account Schedules, easier Reporting
  • Jobs Enhancements
  • CRM: New Wizard
  • Item attributes: long missed
  • Integration: Payment services, Paypal, OCR Line recognition
  • Cortana Intelligence: Sales and inventory forecasts
  • PowerApps & Microsoft Flow

Not all features are available in the first release.

So let’s start with NAV 2017. Well done, Microsoft. 😀

Cheers