Skip to main content


         This documentation site is for previous versions. Visit our new documentation site for current releases.      
 

This content has been archived and is no longer being updated.

Links may not function; however, this content may be relevant to outdated versions of the product.

How to write an agent activity

Updated on September 10, 2021

Summary

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.

 

Suggested Approach

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.

Have a question? Get answers now.

Visit the Support Center to ask questions, engage in discussions, share ideas, and help others.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega.com is not optimized for Internet Explorer. For the optimal experience, please use:

Close Deprecation Notice
Contact us