Power Automate allows you to run custom JavaScript code and get output as a dynamic object. Learn how to use the ‘Run JavaScript‘ action and return output in your desktop automation flows.
In Power Automate, you can use the “Run JavaScript” action to execute custom JavaScript code and return the output as a dynamic object.
Here is an example of how you might use the “Run JavaScript” action to return the output of a JavaScript function in Power Automate:
- Add a “Run JavaScript” action to your flow and configure it to run your JavaScript code.
- In the “JavaScript” field, enter your function and make sure that it returns a value.
- Connect the output of the “Run a JavaScript” action to a variable or another action that uses the output.
- Save and run the flow to test the output.
For example, if you want to return the current date, you can use the following JavaScript code in the “Run a JavaScript” action:
var today = new Date();
WScript.Echo("Date is " +today);
You can then use the output variable in another action in the flow like sending the output to a email or storing it in a database.

It’s important to note that, JavaScript that you execute in Power Automate runs on the server, so you can’t access the browser’s DOM, or other client-side functionality.
You must be logged in to post a comment.