cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
dragsdale
New Member

Executing JavaScript

I am experimenting the PAD Scripts.  I got the "Run VBScript" to work, now trying the "Run JavaScript" action.

 

I expected the statement: console.log("Text Here") to populate the return variable "JavascriptOutput", but it thru an exception.  Based upon a response from another user, I tried using "WScript.echo("Text Here") and it worked.

 

From what I have read, 'WScript" is can be used in JScript or VBScript, but the description says "Run JavaScript".  I don't know if this is an error or what.  I am an experienced reactive web developer, so I would like to be able to leverage JavaScript when possible.  

 

dragsdale_0-1616161143238.png

Thanks.  I am excited by the potential of PAD, it could be another game changer.

1 ACCEPTED SOLUTION

Accepted Solutions
fraenK
Memorable Member
Memorable Member

As you already figured out yourself, the runtime understands JScript, which is a ECMAscript based dialect from Microsoft. Console.log isn't part of the original spec, that's why it doesn't work.

 

You could run your JavaScript code within a browser of your choice with:

https://docs.microsoft.com/en-US/power-automate/desktop-flows/actions-reference/webautomation#execut...

View solution in original post

2 REPLIES 2
fraenK
Memorable Member
Memorable Member

As you already figured out yourself, the runtime understands JScript, which is a ECMAscript based dialect from Microsoft. Console.log isn't part of the original spec, that's why it doesn't work.

 

You could run your JavaScript code within a browser of your choice with:

https://docs.microsoft.com/en-US/power-automate/desktop-flows/actions-reference/webautomation#execut...

kelway
Helper II
Helper II

A caution I just discovered with javascript outputting a variable from WScript.echo: this will append a CRLF to the end, and so when I was trying to concatenate strings into a filename box with the variable, it was sending an enter to the dialogue and exiting it. Was more difficult to find than I would have liked.

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Power Automate Designer Feedback_carousel.jpg

Help make Flow Design easier

Are you new to designing flows? What is your biggest struggle with Power Automate Designer? Help us make it more user friendly!

Top Solution Authors
Top Kudoed Authors
Users online (3,273)