Chained querys not retrieving the newly created id

  1. My goal: I have 2 chained querys where :
    1. 1st one is creating a new line in the main table
    2. 2nd one logs the creation in an event table
  2. Issue: When I try to get the new id value, it doesn’t give me the right value… I tried many things and asked ChatGPT but none of the solutions solve the issue…
  3. Steps I've taken to troubleshoot:
    1. split in multiple steps
    2. add logs (cf on the screen above…)
  4. Additional info: I mainly use GUI for the querys and tables are Retool database stored.

What would you recommend ?

Many thanks for your help and wishing everyone a happy new year.