Editing the code behind Power Automate

Editing the code behind Power Automate

Both #LogicApps and #PowerAutomate share the same underlying technology stack. While Logic Apps allows for direct editing of the JSON code through the code view, Power Automate does not offer this functionality natively.

However, I recently discovered a solution that works similarly, though it's not quite the same.


Problem Statement: How can one efficiently edit the JSON code behind Power Automate to achieve the desired output without spending excessive time and effort.


Scenario

I have a boilerplate text that is separated by the "\n" delimiter, and I need to split it into a list based on this delimiter. To achieve this, I used the "split" function in Power Automate and entered "/n" as the delimiter.

split(variable('Text_variable'), '\n')        

However, upon running the flow, the result was not as expected. It did not split anything and returned an array with the complete sentence as one element.

Error flow

If we click on the ellipsis button on the compose action we have a item called "Copy to clipboard (Preview)".

Ellipsis Menu

Upon pressing, a JSON code will be copied onto your notepad which looks like below and if you notice even though I put the delimiter as "/n" it was recorded as "//n" due to auto-escaping nature of Power Automate connectors.

Unedited code

Now we can remove the extra backslash (/). Select and copy the complete edited tchacode as below

Edited code

Now try to add a new connector in the flow and switch to the "My clipboard" tab and you should be able to see you copied code automatically, if not then press Ctrl + V.

My clipboard section

By hovering over the ? icon, you will be able to view the code and select the option that displays your modified code.

New connector added

Now run the flow and you will see that now we have the desired output

Correct output

This approach allows you to edit the code behind Power Automate, similar to how it's done in Logic Apps.

Siva sagar Pelluri

Aspiring Full-Stack Developer | Cloud Computing Enthusiast | Passionate About Scalable Solutions

4 周

Interesting

Mohammed Hamza Khan

TCS Digital | Speaker @Microsoft Reactor |D365 technical consultant I Generative AI | Power Apps | Customer Success Architect Team Member at Tata Consultancy Services| AI-900

4 周

Great observation and explanation Khizar Ansari

Sandeep Angara

Power Platform | Dynamics 365 Fin & Ops

4 周

Interesting

要查看或添加评论,请登录

Khizar Ansari的更多文章

社区洞察

其他会员也浏览了