Hey @dakes
Iād recommend that you use await syntax for a cleaner version:
const result = await queryStatusFiltered.trigger({
additionalScope: {
p_id_party: fundsTable.selectedRow.entities_id,
},
});
return formatDataAsArray(result);
If you need more explicit error handling, this helper pattern is worth bookmarking:
function triggerAsPromise(query, additionalScope = null) {
return new Promise((resolve, reject) => query.trigger({
onSuccess: data => resolve(data),
onFailure: error => reject(error),
additionalScope,
}))
}
const result = await triggerAsPromise(queryStatusFiltered, {
p_id_party: fundsTable.selectedRow.entities_id,
});
return formatDataAsArray(result);
More on that pattern here: Trigger Queries as Promises