Power Automate Desktop: Execute JavaScript Code and Get Output

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:

  1. Add a “Run JavaScript” action to your flow and configure it to run your JavaScript code.
  2. In the “JavaScript” field, enter your function and make sure that it returns a value.
  3. Connect the output of the “Run a JavaScript” action to a variable or another action that uses the output.
  4. 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.

Up ↑

%d bloggers like this: