Line 13:
Line 13:
You can also use triggers to modify the behavior of Dolibarr itself: for example, to create a contract automatically when an invoice is validated, a fill a log file when a record is deleted, ...
You can also use triggers to modify the behavior of Dolibarr itself: for example, to create a contract automatically when an invoice is validated, a fill a log file when a record is deleted, ...
−
Note that triggers is a feature for developers that is limited to business CRUD events (Create | Read | Update | Delete). There is another feature for developers to inject custom code in the application called the [[Hooks system]].
+
Note that triggers is a feature for developers that is limited to:
+
* business CRUD events (Create | Read | Update | Delete).
+
* change of the primary status of objects
+
There is another feature for developers to inject custom code in the application called the [[Hooks system]]. Note, for historic reason, when you send an email, this generates also a trigger call even if this case is not among the 2 allowed.
So, to add your own code that will be triggered by a Dolibarr trigger, this is the process:
So, to add your own code that will be triggered by a Dolibarr trigger, this is the process: