Referencing a newly added row within actions

What is the recommended way of referecing a newly created row within a custom action. I have thought about using single value whole row to get the last row in the table. However, I feel like there is risk here… that in busy times, the last row could be added by a different action / user than the current action. Ideally the “add row” step would return the associated rowId that could then be used as a reference to the correct row.

In the screenshot below… I want to be able to set a value after the wait step in the row created by the add row step.

TIA

I don’t like using a Set Column action immediately after an Add Row action. It’s way to vulnerable if the Set Column action runs before the new row has been completely added. What type of values are your trying to set in the newly added row. When possible, I prefer to set the values during the Add Row instead of after it is added.

3 Likes

I agree with you Jeff. The problem I am having is I need to generate a code based on the data of the row being added. It is a unique code… which combines an incremented number (automatically increased as new rows are added - but needs to be stable so I have to write the value into the column rather than using a computed column which could be changed if the associated data changes.

So, I am using a computed value to create the code which works when the row is added… but then I need to get that value and write it statically to another column… so that this code does not change in the future.

I have implemented a wait (2 secs) before to ensure the row is added… but not happy with that… hopefully we see some non user initiated actions available within glide in the near future.

I take it your code depends on a number, so what I would do is:

  • Adding a helper table.
  • Add a basic number column. This column would store the next “numerical ID” the next record would take.
  • Add another column to format the number with text if needed.
  • Cast that back to the user profiles table using a single value column.
  • Use that value as a special value in your form. That would take away the need to use set column values, and the value is already calculated before you enter the form.
  • After the form is submitted, use a relation to increment the global number column in the helper table.
3 Likes

Thanks, that is exactly what I am doing already with the helper table… but I needed to append it to the form data that is being saved. I am going to change that requirement which will then work as you say with the value already calculated.

1 Like