Dynamic combo box values sourced from REST APIs

I am trying to create an input form that populates ComboBox1 with user information retrieved by consuming a REST api (Get all users).  This works.

When I select a user from ComboBox1 I want ComboBox2 to be populated by consuming a second REST api (Get To-Do's for user = {userid}). Based on the user selected from ComboBox1.

I think what I need is a WebBlock to hold my ComboBox2 with the GetToDos RESTapi defined in the WebBlocks Preparation and then have a AJAX Refresh in ComboBox1 OnChange event.  However I can't figure out how to tell the AJAX refresh to trigger the WebBlock.

Of course I could be going about this the wrong way as I am new to OutSystems and feel like I might be jumping into the deep end with my first use case.

Any help is much appreciated!



If you want to keep your second combobix in webblock that is ok but you can do that without it also.

You can do below steps in you screen itself.

1. Set source of your combobox to a local list type variable on screen

2. Define onchange event if combobox1

3. Call your api to fetch data for combobox2

4. Assign response to the local list variable which is set as source to combobox2

5. Call ajax refresh and give me I'd of combobox2 (don't forget to give your combobox a name otherwise you will not be able to find it in ajax refresh, possibly this is that thing you were asking about webblock)


Thank you!

You helped me on two points...

1) I didn't realize I had to assign the API call response to a variable.  I was trying to set it directly as the source to the second combobox, but it wasn't available to select.  I had assumed it was a "scope" issue because it was getting called in the OnChange event but hadn't figured out how to get around it,
2) Naming the widget is required to make it available for the Ajax Refresh to connect to it.(duh)

It is working now!

Good to see that you are able to resolve your issue.