Bulk upsert via a primary key does not return updated/inserted records

I am trying to retrieve the inserted/updated rows on form submit so I can use the generated autoincrement ID field. Records are inserted/updated in the DB. However, data property of the query only has a single property which says sqlCommand: BULK_UPDATE_BY_KEY. According to the docs, I should be getting the inserted/updated rows in data, but this is not the case. What am I missing? Please help.

Hello @Jorge_Cespedes_Vega!

Apologies for the issues, I was almost certain that the queries would return this data but I just tested it out and it seems I can't get an ID that was auto-incremented :sweat_smile: :thinking:

Could you link me to the docs you found? I was using a Retool DB table for my bulk upserts and wanted to confirm you are using the same type of resource.

I was trying all kinds of things to figure this out but I think this is a bug/missing functionality that I can definitely request. I was able to use query.records but that will just return the data entered in, it doesn't contain any 'new' data from the DB such as ID.

It is definitely technically possible as under the hood it would pretty much be writing a Postgres query that will return the most recently added rows that would be chained in an 'On Success' query run.

Will follow up on this and get it sorted for you! :saluting_face:

Could you give me more details on your use case?

Do you just need the ID of the newly created rows?

The database will add in the autoincrement IDs and when you run a GET from the table these IDs should be automatically added to a table that has the GET request as its source.

Hi Jack_T,

Thanks for your reply. I need to send the submitted payload to a webhook to feed external systems. That's why fetching the data after saved doesn't cut it. I would like to include the generated IDs for each row in the payload sent to the webhook.

Ah ok thank you for the details!

Let me try to figure out the best way to accomplish this.

My guess is that if your from is adding on new rows on submit, we could just run a second query on success to grab back all the data plus the ID the table is adding.

Wanted to check how often your form submissions are 'updating' old rows, as I imagined you were using the 'upsert' action to handle editing old rows and adding new rows.