Query not working with additional scope

Hey guys,

Thanks for being here! What should be the value of 'orderIncidentID' here if you want the order be filled by another query its 'additionalScope'?

insertOrderItemIncidentRetool.trigger({
additionalScope: {
orderIncidentID: id,
},

The other query looks like this. Right now this is not working, claiming my id is not an integer. But when I 'hardcode' the value, it is working. Also, the console shows it is an integer before inserting it. I am using the .then syntax. For the full custom javascript query, see below. What can it be?

Full custom query:

insertOrderIncidentRetool.trigger({
additionalScope: {
id: orderData.selectedRow.data.id,
},
onSuccess: function(data) {
console.log(orderData.selectedRow.data.id)
}
}).then((data) => {
const {id} = data.insert_order_incident_one
return {id}
}).then(({id}) => {
console.log(id)
insertOrderItemIncidentRetool.trigger({
additionalScope: {
orderIncidentID: id
},
onSuccess: function(data) {
console.log('succeeded!')
}
})

})

Howdy @RobRetool,

Is orderIncidentID your field name? That's the only place I see it in your screenshot. You want your actual database field name in the first column and the scope variable in the value column. Also, for a scope variable you do not include .value just the variable name.

Aah alright, clear! Then this topic can be closed. Thanks @bradlymathews