I have created a query in query library. This query uses variables.
Then I imported this query in my app and set up this variables to take values from the components
Now I want to manually trigger this query and override some variables:
const campaign_id = campaign_seq_nextval.data.NEXTVAL[0];
campaign_insert.trigger({
additionalScope: {
campaign_id,
}
})
but query still get's executed with default values and values I'm passing to additionalScope is ignored.
Please help to solve this.
not all resource query types have access to additional scope
if you don't see the Additional scope
section here you probably won't have access to additional scope. Instead of using additional scope though you can set a variable to that value: myVariable.setValue(campaign_id)
. Then in your campaign_insert
query you can get the value with myVariable.value
This is oddy and anti-intuitive but it work. Thank you
I think they've designed it this way because most resource queries have an option under Advanced
to automatically trigger the query when specific input values change, since the key names of the additionalScope
are unknown (we name them) and dynamic themselves and the object itself is optional it'd be much more complex to implement this Watched Inputs
functionality .... its just a guess though