Make sure "toggle" is set to false. It should be by default
app.field(<field>).selectValues( [<values>] )
but if you do
app.field(<field>).selectValues( [<values>], true )
then "toggle" is set to true and it will toggle selections, instead of the behavior you are looking for.
You can also set "toggle" to false explicitly.
app.field(<field>).selectValues( [<values>], false )
I did have toggle set to "true". However, I am getting a "Function not allowed on this object in app modal mode" error when I try to call selectValues(['MyValue'])? Any ideas how to resolve this?
Update: I think this is because the field selection box is open, but I don't see any events other than OnData that I can attach to, and I don't see any way to determine if the "object is in app modal mode" or not inside of the method.
Hmm, not entirely sure, haven't experienced the problem myself. Maybe using the selectValues method of the Extension API instead of from the Field API would solve your problem? https://help.qlik.com/en-US/sense-developer/3.1/Subsystems/APIs/Content/ExtensionAPI/selectvalues-method.htm