AL with VSCode: Run Extension Objects (with PowerShell)

Some time ago, Mark blogged an interesting article about running objects from extensions. You can read it here: https://markbrummel.blog/2017/05/20/tip-58-run-extension-objects/ .

It made me wonder .. how would I solve this? And one of the problems of asking myself these kind of questions is .. the answer is always the same :-/:

Powershell

And apperantly, I already blogged something really similar as well :-):

http://www.waldo.be/2015/07/09/start-nav-object-in-rtc-with-powershell/

I created some functions in my module to be able to run objects in a windows client. This enables me to do something like this:
Running a codeunit:

Start-NAVApplicationObjectInWindowsClient `
  -ServerInstance NAV `
  -ObjectType Codeunit `
  -ObjectID 70000000

Running a table:

Start-NAVApplicationObjectInWindowsClient `
  -ServerInstance NAV `
  -ObjectType table `
  -ObjectID 70055050

Works like a charm for Extension objects as well :-).

What about the Web Client?

Well .. Duh ;-). Only, the Web Client only supports to be able to run a Page or a Report. So in the latest version of my Powershell-modules, I included a function to support that: Start-NAVApplicationObjectInWebClient.

It’s very the same as the other Start-function – here is an example:

 

Start-NAVApplicationObjectInWebClient `
  -WebServerInstance DynamicsNAV100 `
  -WebClientType Tablet `
  -ObjectType Page `
  -ObjectID 700500000

You can see it supports also running the tablet client and the phone client. How easy can it get?

So, I need to have a new project with powershell-stuff to combine with my AL development?

Most certainly not! You can easily combine powershell-scripts with al-development! Just take this screenshot as an example:

061317_1622_ALwithVSCod1.png

This is just a simple example where I included a PowerShell-script in a subfolder of the workspace of an al-project. It keeps being an al-project (mind the “launch.json”, but I’m able to execute Powershell as part of the workspace. Not with F5, but with F8 (execute the selection).

How do i make your modules available on my system

Making my modules available on your machine you can do simply by installing them from the PowerShell Gallery by executing this :

Find-Module | where author -eq waldo | install-module

Enjoy!

Related
Recommended