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.
TABLE: dbo.PROPERTY
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:
LAST_UPDATE_DATE
LAST_UPDATED_BY
I would like to update these fields with the system date and current_user.id.
Questions:
Is there an easy way to do this within this BulkUpdate query?
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).
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 ) Try something along the lines of:
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()) )
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: