Publish & Run Current Object from VSCode – with a single command

I’m not writing a blog about every single (new) command in my “CRS AL Language Extension”. But this Sunday, I added an interesting one. One that I should have had created for a long time – but simply didn’t think of it, until Daniel (TheDenster.com) explicitly asked for it on GitHub.
Just imagine, you’re building an app, with many pages, and you want to build a page, test it, build the next one, test it .. . You kind have to:
– Publish the app
– Run the object after the app was published
The request was simple: combine both steps in one command in VSCode:

Publish & Run Current Object

And personally, I have been using it all day :-). So I thought – let’s just share it, so people know it exists and don’t have to find out by accidentally running into it ;-).

How to run it

Well, it’s simple, just:

What does it do .. exactly!

Well, it IS going to run a command from the “AL Language” extension first. The exact statement is this one:

The reason why I’m running the “without debugging” version, is because it’s the only way for me to mitigate that 2 browser tabs will be opened. Because the publish-step will open a tab, and then the “Run Object” (which is simply opening an URL) will open another tab.
You might say: “dude, you got a setting for that in the launch.json”. And you are right. In the launch.json, we can set the launchbrowser to “false”:

But …
This only works with the command “publish without debugging”, not with the normal F5. So .. that’s why I’m using this command ;-).

Keyboard Shortcut

You might have been using the “Run Current Object” already in the past.

Well, this still exists, and has a keyboard shortcut for it. I didn’t do that for the new command, but do know, you can do that yourself! You can even take this keyboard shortcut, and attach it to this new command.
Simply go into

Find the command and press the “+” sign on the left of it

Now, press the keyboard shortcut that works best for you – you can even override another one, like I did here to override the already existing “Run Current Object” shortcut:

Now you’re done.

Enjoy!

5.00 avg. rating (97% score) - 1 vote

Permanent link to this article: https://www.waldo.be/2021/01/13/publish-run-current-object-from-vscode-with-a-single-command/

10 comments

2 pings

Skip to comment form

    • Herman van den Born on January 13, 2021 at 12:01 pm
    • Reply

    Cool!, do note that it does only work for Page,Report and Table.

      • waldo on January 13, 2021 at 12:34 pm
        Author

      And Query 😉

    • Jose Madrigal on January 19, 2021 at 5:29 pm
    • Reply

    It dosen’t work for me.

    It gives me this error:

    HTTP Error 502.5 – Process Failure

      • waldo on January 19, 2021 at 5:40 pm
        Author

      Sorry to hear – never seen this – wouldn’t know how to mitigate it 🙁

      • Volker Drews on January 21, 2021 at 10:21 am

      It doesn’t work for me too.
      same Error 502.5
      Only in BC17

    • Bjarki on January 20, 2021 at 1:52 pm
    • Reply

    Wouldn’t changing startupObjectId be enough (and changing it back once it’s done)? That way, you’d also be able to debug the object.

      • waldo on January 20, 2021 at 2:18 pm
        Author

      Could be – but it’s based on the function “Run Object” I already had, that does not use the F5 (publish) command at all .. so ..

      But yes, I could do that.

    • VolkerHTE on January 20, 2021 at 7:38 pm
    • Reply

    I’m using this Tool in BC 14. It’s perfect!!
    But i can’t start Run Current Object in BC 17.
    I got HTTP Error 502.5 – Process Failure

      • waldo on January 21, 2021 at 10:34 am
        Author

      What can I say? Looks like you have a connection failure.. . You can open an issue on my github and report with more details (how you set up your enviromnents).

      • Johan Pettersson on February 1, 2021 at 4:33 pm

      I had this problem. I was fixed for me by adding this setting:
      “CRS.WebServerInstancePort”: “8080”,

  1. […] Publish & Run Current Object from VSCode – with a single command […]

  2. […] Source : Waldo’s Blog Read more… […]

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: