Agent functionality is separated into two kinds of processing. Rather than mixing both types of processing in one activity, it is best practice to put each type into their own separate activity.
Agent functionality is separated into two kinds of processing:
- business logic – what the agent is supposed to do (process an assignment, send an email, update a status in a work object, etc.)
- transactional – the system functions which enable the business logic process – taking out a lock on the work object to be updated, committing changes to the database, etc.
Rather than mixing both types of processing in one activity, it is best practice to put each type into their own separate activity. Separating the two means that if the transactional processing fails, the system doesn’t waste time trying to process the business activity. For example, if the system can’t get a lock on a work object, then it can’t update it, and shouldn’t waste system resources trying.
The agent activity contains the agent task; it may be named with whatever descriptive name you want. This activity should only contain business logic. It should not attempt to obtain locks on any objects, nor should it perform any database commit or rollback operations; it should not perform any immediate (“Write Now”) database operations. These should all be part of transaction processing, which is handled automatically. In the agent activity, all operations should be deferred, using Obj-Save or Obj-Delete with WriteNow unchecked. However, Release On Commit should be checked.