Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Answered

How to Pass an array from JavaScript to PowerAtomate?

(0) ShareShare
ReportReport
Posted on by 354
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
    354 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
    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

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

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…

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
CUI10061954-0 Profile Picture

CUI10061954-0 24 Community Manager

#2
Jahanvi Profile Picture

Jahanvi 13

#3
Jatinkumar Profile Picture

Jatinkumar 9

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans