10
Views
4
Comments
[Run Javascript Advanced] RunJavascriptAdvanced action returns value of the previous call
run-javascript-advanced
Service icon
Forge asset by Leonardo Pires
Application Type
Service

Hi,

I'm trying to use the RunJavascriptAdvanced action. the test is simple:

  • type a script
  • click a button that (see the screenshot):
    • runs this script
    • gets it's value
    • displays the value in an Expression control

The issue is that each time I get the value of the previous test, previous button click. Calling the RunJavascriptAdvanced action twice doesn't improve the issue.

What do I do wrong?

Regards

Tomasz


screenshot.png
2025-12-18 01-28-51
Peter Hieu

Hi @Tomasz M Lipinski 

I’m not sure whether you’re using a Reactive or a Traditional app, but here’s some information that may help:

  1. This Forge component works properly in Traditional Web applications. You can check the AdvanceJS Demo for reference.

  2. In Reactive Web applications, it doesn’t work as expected due to architectural limitations.

It will be much easier for others to help if you attach your OML file. That way, people can better understand your scenario and provide an accurate answer. 

Hope this helps!

Peter Hieu

Test.oml
UserImage.jpg
Tomasz M Lipinski

Hi,

Please find the attached .oml. Run it, enter the desired script (it can be just: "123"), click Run. The result will be displayed under the "Results" label.

I've downloaded and run your test.oml. It behaves in the exactly same way as mine:

  • run the app
  • click "Get Data": nothing
  • click it again: "10" is displayed

Your test is build using OuSystems UI Web library, mine - using the deprecated Dublin template and Silk UI Web library. But it doesn't matter. I'm  also using a very old version of Service Studio (11.14.16) but I pretty believe it also doesn't matter.

Kind regards

Tomasz

RunJavascriptAdvancedTest_v1.oml
2025-12-18 01-28-51
Peter Hieu

Hi @Tomasz M Lipinski 

I tried it but it still doesn’t work. However, you can check this Forge component — it might help when you need to use JavaScript. 

How to use JS on Outsystems.

Hope this helps

Peter Hieu

UserImage.jpg
Tomasz M Lipinski

Hi @Peter Hieu ,

thanks for the answer. The referred component is a good job for novices. But unfortunately they all show techniques which I'm already familiar with and which don't address my case.

My case is: being inside a screen action how to call some JS script and immediately get the returned result. The Run Javascript Advanced seemed to be the answer but there is some issue with using it - as I described.

You say "...it still doesn't work". Do you mean that the example .oml (that I've attached)  works in the way I described, i.e. it doesn't return the evaluated value immediately?

Kind regards

Tomasz

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.