cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
itssujeeth
Advocate I
Advocate I

Power Automate Desktop - RPA javascript

I'm trying to develop a flow -which requires javascript to be executed within steps. Question - How can I change a variable within javascript code?

1 ACCEPTED SOLUTION

Accepted Solutions

Hello @itssujeeth,

 

If you desire to change the value of a PAD variable using JavaScript, that can be done by echoing the result of your JS calculation using the command "WScript.echo("String") and then setting the variable that needs to be changed to the output result of the "Run JavaScript" action - screenshot below:

adijain_1-1602879998990.png

 

This will set the variable %JavascriptOutput% to "test". Hope it helps!

 

View solution in original post

4 REPLIES 4
CFernandes
Super User
Super User

@itssujeeth 

 

I am a bit confused with your question, "Change a variable". You can click on fx and reference a variable.

 

CFernandes_1-1602869138648.png

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

 

 

 

 

Sorry for being vague in my question. As part of my flow, I need a variable to be assigned a new value which needs to be calculation using a logic. An easy approach tried was to write a javascript implementation for this logic and trying to assign the value. But it doesn't work

Hello @itssujeeth,

 

If you desire to change the value of a PAD variable using JavaScript, that can be done by echoing the result of your JS calculation using the command "WScript.echo("String") and then setting the variable that needs to be changed to the output result of the "Run JavaScript" action - screenshot below:

adijain_1-1602879998990.png

 

This will set the variable %JavascriptOutput% to "test". Hope it helps!

 

I can use at input variables all pad variables (text format), but as output variable only one (wscript.echo...)? Is there any other option that I can output more variables ore change other pad variables value? 

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.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

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,462)