BulkUpdate assistance

Hi Retool,

Hoping you could help me. I currently have a query that displays into a table. The table has a few editable fields.

I use the Bulk Update feature and so far, it's working great.

Action Type: Bulk update via a primary key
Primary Key Column: PROPERTY_ID
Array of records to update: {{table2.recordUpdates.map(row => _.omit(row, ["description"]) ) }}

This works because the queried/displayed field names matches the database table field names. I omit description as that is derived from somewhere else.

In my table, I have two other fields:

I would like to update these fields with the system date and current_user.id.


  1. Is there an easy way to do this within this BulkUpdate query?
  2. Does BulkUpdate update all the rows in the table or just the specific row(s) that have changed? (If it changes all rows regardless of change or not, this might defeat the purpose).

Much appreciated!


  1. Hmmm, not done this, but I might set you on the right path (in other words make you do the work so I know the answer for when I need it :wink:) Try something along the lines of:

    {{table2.recordUpdates.map(row => _.omit(row, ["description"].set(row, {'LAST_UPDATE_DATE'}, moment()).set(row, {'LAST_UPDATED_BY'}, 'Fred') }}

Lodash docs are here: Lodash Documentation

  1. recordUpdates is only the updated records so only those are sent.

Thanks @bradlymathews. I like the direction you're going with this.

I focused on LAST_UPDATE_DATE. I tweaked the syntax slightly and tried:

{{table2.recordUpdates.map(row => _.omit(row, ["description"]).set(row, ["LAST_UPDATE_DATE"], moment()) ) }}

I received:

!Data must be an array
error:"Unprocessable Entity"
message:"Data must be an array."

I've dumbed it down to see if I could get LAST_UPDATE_DATE to populate, trying both:

{{table2.recordUpdates.map(row => _.set(row, ["LAST_UPDATE_DATE"], moment()) ) }}
{{table2.recordUpdates.map(row => _.set(row, {'LAST_UPDATE_DATE'}, moment()) ) }}

I still receive the same error "Data must be an array."

I feel like I'm missing something very minor here. Any suggestions?

Much appreciated!

Put this into a transformer so you can Preview what it is that is actually being sent to your server. Could be .set() is the wrong way to go or the syntax still isn't quite right. This will get you more visibility into it anyway.

Transformers work a little different so you will need to extract recordUpdates so your trasnformer will look something like this:

let records =  {{table2.recordUpdates}}
return records.map(row => _.omit(row, ["description"]).set(row, ["LAST_UPDATE_DATE"], moment()) )
1 Like


I do the same pass through into two column, last user and modified date. I'm using a JS transformer to determine the values and pass it into the two columns:

Afterwards in your bulkupdate query the array to be passed needs to reference the transformer.value.

Array of records to update

1 Like

@bradlymathews and @Nicolas

Thank you so much!

The transformer did the trick followed by the BulkUpdate referencing the new array. Simply Amazing!

This is a very helpful post and hopefully others can make use of it.