Break up transaction brackets
Ninox offers possibilities to break the transaction context with the instruction do as deferred.
Let's assume that an external system is to be informed when an invoice status changes. Then u can use do as deferred to prevent this API call, which should run as part of a trigger, from blocking subsequent transactions.
do as deferred
http (...)
end
You can also continue to use the result from the API call. However, it is important that this further use itself creates a new transaction context, otherwise the http() call would already be part of a writing transaction.
let invoice := this;
do as deferredlet response := http(...);
do as deferred
invoice.Message := text(response.result)
end
end
In this case, the first do as deferred is a reading transaction, as no data is changed. The nested do as deferred is a writing transaction, as a field of the invoice record "invoice" is changed.
Also see Optimize Performance of Scripts for further information.