Synchronous API Smart Events
Overview
You can ensure that a group of events, including the triggering action, are executed in order as a set using synchronous API Smart Events.
This lets you think in terms of a larger task where synchronous API Smart Events are sub tasks. On failure of any sub task, nothing is saved (not even the triggering action), and the system issues an error message.
In addition to providing a grouping mechanism, this feature also eliminates the possibility of collision, concurrency, and overwriting between events since they are executed one after another.
How it works
When an action triggers a synchronous API Smart Event, the system attempts to execute all synchronous events that are part of the resulting chain of actions. This is done in alphabetical order according to the Smart Link IDs, and it occurs before the triggering action is committed. If the chain executes successfully, the triggering action is saved and any asynchronous Smart Events are then executed as well. If the chain has a failure, the triggering action is not saved, the synchronous API Smart Events are rolled back, and no asynchronous Smart Events (of any type) are executed.
You can see if your Smart Events were executed in your offline job history.
Creating synchronous API Smart Events
When creating API Smart Events in the Sage Intacct UI:
- Select the Synchronous Smart Event checkbox.
- Use the NAMESPACE_PREFIX_DESC convention when naming your Smart Events to control the order of event execution (see Best Practices below).
Best practices
Though powerful, synchronous API Smart Events add a level of complexity, so you should be thoughtful in your approach. For this reason, we recommend the following:
- Only use synchronous API Smart Events when you want to ensure a group of events are executed in a particular order and as a group.
- Use synchronous API Smart Events when you want to ensure the triggering action is tied to the event actions in terms of success and failure.
- Use a prefix in your IDs to group your related synchronous API Smart Events and ensure they are occurring in the correct order. The events will execute in alphabetical order. A good format to use is NAMESPACE_PREFIX_DESC. For example, you could use a convention like:
- FA_01_DESC
- FA_02_DESC
- FA_03_DESC
- If you want to re-order synchronous API Smart Events that were created from a package, inactivate the synchronous API Smart Events in the package, then create new ones.