Will it be possible to provide an option to user to select the layer which have been added on map then define the field and SQL expression in Query widget rather than picking from local config ?
There is a widget for this:
https://community.esri.com/docs/DOC-12050-select-by-attributes-widget-v10-07202018