Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 Community / Forums / Sales forum / How to Pass an array f...
Sales forum
Answered

How to Pass an array from JavaScript to PowerAtomate?

Posted on by 359
Hi,
 
I have a requirement, like I have a sub-grid on custom Entity, on that sub-grid I need to add a download button, on click of that button I want to run an Ms flow.
 
Where I need to pass an array of selected records id from the sub-grid and I want to get these id's inside the power automate to achieve my further requirements.
 
But I am not able to trigger the Ms flow on click of button.
 
Here I have attached two SS below, where I have written the JS code to run a Ms Flow and second for Ms flow /Json Schema/ to get the array of id's.
 
Js Code to run the MS flow:
 
 
My Array After Converting into JSON String:
 
[{/Id/:/12348/,/Name/:/Test1/,/TypeName/:/new_abc/,/TypeCode/:333444}
,{/Id/:/4567/,/Name/:/Test2/,/TypeName/:/new_efg/,/TypeCode/:35678}]
 
MS Flow JSON Schema:
 
 
JSON Schema Code:
 
{
    /type//array/,
    /items/: {
        /type//object/,
        /properties/: {
            /Id/: {
                /type//string/
            },
            /Name/: {
                /type//string/
            },
            /TypeName/: {
                /type//string/
            },
            /TypeCode/: {
                /type//integer/
            }
        },
        /required/: [
            /Id/,
            /Name/,
            /TypeName/,
            /TypeCode/
        ]
    }
}
Categories:
  • Himanshu Kamboj Profile Picture
    Himanshu Kamboj 359 on at
    How to Pass an array from JavaScript to PowerAtomate?
    yes,
     
    I had initialized the XMLHttpRequest instance object globally, but now I have added all request headers as per the link provide by you and now my Ms flow getting triggered.
     
    Thanks for the solution!!
  • Verified answer
    Dengliang Li Profile Picture
    Dengliang Li Microsoft Employee on at
    How to Pass an array from JavaScript to PowerAtomate?
    Hi,

    I don't see in your code the step of creating the XMLHttpRequest instance object, which is required to send the request.
    I found an article about running Microsoft Flow through Custom Ribbon Button using http request, please refer to this article.
    https://www.inogic.com/blog/2019/10/how-to-run-microsoft-flow-through-custom-ribbon-button-using-http-request/

     I hope my answer is helpful to you! If you have any other questions, please feel free to contact me.
     
    Best Regards,
    Dengliang Li

Helpful resources

Quick Links

Dynamics 365 Community Update – Sep 16th

Welcome to the next edition of the Community Platform Update. This is a weekly…

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,339 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,177 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans