Start Production with a SQL Trigger
So I would like to start a production with a service that has an SQL trigger for after and INSERT. Then I would like it to start a process. Could someone help me in the direction of a solution, please and thanks.
Comments
Hi Unai,
What you’re trying to do—triggering a process based on a database insert—is a common pattern. However, using a SQL trigger to directly start a production or business process isn’t recommended in IRIS.
SQL triggers execute within the database transaction, and invoking interoperability logic from there can lead to locking issues, transaction rollbacks, and performance concerns.
The typical and safest approach is to use an EnsLib.SQL.InboundAdapter to poll the table for new records. For example, you can:
Add a flag column (e.g., Processed = 0)
Configure the adapter with a query like:
SELECT * FROM YourTable WHERE Processed = 0
After processing, update the record to mark it as processedThis keeps your database operations and interoperability processing cleanly separated, and it aligns with standard IRIS patterns.
If you need near real-time behavior, you can tune the polling interval to be very short.
Hope that helps point you in the right direction.