cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
BenediktE
Level: Powered On

Pass selected items from listbox as parameter to restful webservice

Is it possible to get all selected items from a Listbox control as table?

 

For example, I have a web-api that is expecting the following object:

 

{

    userIds: []

}

 

UserIds is an array/table. Than I've a ListBox which contains items of the following structure:

 

{

    "value": "..."

    "userId": "..."

}

 

Now I want to call a web service on a button click and pass all selected user. For example:

 

MyApi.SampleSendDocument({DocumentId: document.Id, Comment: SendCommentTextInput.Text, UserIds: UserListBox.SelectedItems.UserId}); Back()

 

But this is not working. I've tried a lot but could not figure out how to do this.

 

Thank you all!

1 ACCEPTED SOLUTION

Accepted Solutions
PowerApps Staff rgruian
PowerApps Staff

Re: Pass selected items from listbox as parameter to restful webservice

PowerApps does not support "arrays". The closest data structure in PowerApps would be a single-column table. If your Web API currently expects UserIds:[value1,value2,...], which is an array, you will need to change the endpoint so it instead expects a column UserIds:[{UserId: value1}, {UserIId: value2}, ...].

 

Then your formula should work:

 

MyApi.SampleSendDocument({DocumentId: document.Id, Comment: SendCommentTextInput.Text, UserIds: UserListBox.SelectedItems.UserId}); Back()

 

I hope this helps.

Radu Gruian [MSFT] ** PowerApps Staff

View solution in original post

2 REPLIES 2
BenediktE
Level: Powered On

Re: Pass selected items from listbox as parameter to restful webservice

Any news here?

PowerApps Staff rgruian
PowerApps Staff

Re: Pass selected items from listbox as parameter to restful webservice

PowerApps does not support "arrays". The closest data structure in PowerApps would be a single-column table. If your Web API currently expects UserIds:[value1,value2,...], which is an array, you will need to change the endpoint so it instead expects a column UserIds:[{UserId: value1}, {UserIId: value2}, ...].

 

Then your formula should work:

 

MyApi.SampleSendDocument({DocumentId: document.Id, Comment: SendCommentTextInput.Text, UserIds: UserListBox.SelectedItems.UserId}); Back()

 

I hope this helps.

Radu Gruian [MSFT] ** PowerApps Staff

View solution in original post

Helpful resources

Announcements
firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Demo Extravaganza Championship Voting Open

Voting Ends: October 30, 2019!

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

Top Kudoed Authors
Users Online
Currently online: 418 members 5,325 guests
Please welcome our newest community members: