setValue not working directly after selectRow

In the most recent example, does it work better if you refactor this example:

await CheckExistingContractID.trigger();
let num = CheckExistingContractID.data[0]['COUNT(ID)'] ;
console.log('num = '+ num);

to

let num = await CheckExistingContractID.trigger();
console.log('num = '+ num);

There's a related post here that talks about an advanced setting on JS queries that can help with keeping track of updated values.

Generally speaking, I'd be curious to hear more about your use case that you originally posted about to see if we can find an alternative if the above doesn't resolve it. For example, in the first example, what is GetMaxID doing? are you referencing the newly selectedRow anywhere?