The issue is that you need the logic to run synchronously in process so that it can actually write out the JavaScript as part of the response to the web client. If you job off the logic it will run in a separate process and there is no way to return the JavaScript to the caller because this is done asynchronously and the response has already been sent by the time your job will finish in all likelihood. If you need something to run asynchronously then use the #call() command in your CSP page.

@Pietro Montorfano - VSCode use with CCR is definitely supported.  You just need to make sure that your workspace is properly defined with isfs, etc to get you access to the files on the server.  Since CCR uses server-side source control hooks, you can actually have people using Studio and VSCode concurrently against your BASE Environment.

We've tried to make it as easy as possible by allowing you to export the VSCode workspace definition directly from CCR (credit: @Timothy Leavitt ).  Go to your Environment Details page and use the "Export (VSCode)" button on the top of your Environment list:

Please try it and let us know if it works for you.  P.S. would you mind adding the #ccr tag to your question so others can easily find it?

Please see details on the yearopt parameter for $zdate (https://docs.intersystems.com/iris20232/csp/docbook/DocBook.UI.Page.cls?...) ... depending on the locale and on the year in question, if you don't specify yearopt you risk have a 2 digit year rather than a 4 digit year (default for my locale is yearopt = 0 which would show 20th century years as 2 digits).  You probably want to specify a yearopt of 4 to force 4 digits all the time.