Learning Transactions

Hi. I’m trying to learn to do more Transactions/Operations in UI Builder to reduce API calls and do multiple API calls simultaneously, while waiting until they are done before the flow continues.

Sometimes I create a list block of API calls in hopes of achieving the same result (does this work?) of doing multiple API calls simultaneously, but stopping the flow until they are all done (ASYNC continues the flow). The list approach works better when I need to use blocks not available in the transactions menu.

Anyways, I keep trying to do a simple “find” operation to fetch the user’s record from the ‘divorces’ table


.

It keeps giving me the following error:
Uncaught (in promise) TypeError: Cannot read properties of undefined (reading ‘find’)
at bundle.js:62:12
at async onClick (bundle.js:57:5)

This is strange, because essentially the same Find operation works elsewhere

I’ve verified it is finding the correct userID and there is a record in that database with that userID.

Hello @David_King

I see that you pass the ownerId argument differently on the first and second image. Do I understand correctly that on the first image the logic works without errors, but when you replace ownerId with method Argument you get an error?

Regards,
Inna

The second image with Method Argument “ownerId” works. The first image, I have tried a few different ways to get the ownerId and get the same error whether the ownerId is:

  • a variable
  • a function
  • a “Get property” of the user record
  • a text string of the correct ownerId
  • the “where” clause is disabled entirely

I have placed a print block before the Find operation inside the transaction to print the ownerId and it seems to work.

Oh jeez. The problem was the variable for the transaction was called “Transaction” in one place and “transaction” in another.