I have a QBO3 task that includes a dropdown list configured to make an API call with several possible parameters.
The API call is:
Process/DatawarehouseQuery?Field1=Foo&Field2=Bar
The fields on the task include:
- DWDropdown: a dropdown list that should render the results of the DatawarehouseQuery api call
- Field1: an input that users can enter data into
- Field2: an input that users can enter data into
I have configured an onchange event handler for the Field1 as follows:
document.id('DWDropdown').retrieve('qbo.Dropdown').refresh({'Field1', this.value});
and similarly for Field2:
document.id('DWDropdown').retrieve('qbo.Dropdown').refresh({'Field2', this.value});
When a user triggers the Field1.onchange event, the API call made is:
Process/DatawarehouseQuery?Field1=Foo
When a user triggers the Field2.onchange event, the API call made is:
Process/DatawarehouseQuery?Field2=Bar
How do I configure the task to pass both Field1 and Field2 to the API call?
The
qbo3.Dropdownbehavior'srefreshmethod requires all the data needed for the api call:As the number of fields grow, maintaining these
onchangehandlers can become unwieldy. As an alternative, you can create a custom function in theJavascriptpanel of the task, and reference that function from each of your onchange handlers:and then your
onchangehandler becomes:When troubleshooting dropdown lists (or any other qbo3 behaviors), consider using the Chrome debugger and Fiddler.
Specifically, you can play with a dropdown list from the debugger console along these lines: