When a record is updated in a table, what would be a way to add that record to another table?

Options

Hello!

A have a "requests" table. In that table X user can add another Z user to access records X user manages. This is as simple as X user entering an email address and 'type of access' (selecting from 2 options) and the record ID # passing dynamically.

The table then stores who added X user, the email address of the new user, the 'record' ID in which that new user can access, and the type of access.

Once the new Z user logs in, they will see the 'record' in their list to approve.

Should this automation be done with APIs? What I'm struggling with here is whether APIs should talk to one another or there is a better approach within Xano.

In short; when X happens in table 5, do Y in table 10 and use reference one another.

Tagged:

Answers

  • arturosanz
    arturosanz Member ✭✭
    edited September 2023
    Options

    I guess you would like to use triggers, so that when a record field is updated a function is triggered to perform something else. Xano doesn't have this feature yet, and probably never will. The reason is because triggers can be very dangerous. They can easily provoke infinite function executions if someone programs them incorrectly. Just imagine what would happen if a trigger executes a function which updates directly or indirectly the same field that triggered the function. This would be an endless loop which consumes a lot of resources and money. It's very dangerous, and almost impossible to detect if there is a chain of triggers and functions which end up in a closed loop.

    What I suggest is to program the updates to other tables within the same API call that "triggered" the action. This is much safer because everything happens inside a sequentially controlled environment, so it is almost impossible to accidentally fall into infinite loop executions.

  • mauromequelussi
    Options

    Use the POST PROCESS function.