Workflow guidelines

In practice, Guidewire recommends that you keep the following guidelines in mind as you work with workflows:

  • If you invoke a workflow TRIGGER, do so synchronously if you need to make immediate use (in code) of the results of that trigger. For this reason, the PolicyCenter rendering framework typically always invokes the trigger synchronously. But notice that you only get immediate results from an AutoStep Workflow Step that might have executed. If the workflow encounters a ManualStep Workflow Step or an ActivityStep Workflow Step, it immediately goes into the background.
  • If you complete an activity, it does not synchronously (meaning immediately) advance the workflow. Instead, a background process checks for workflows whose activities are complete and which are therefore ready to move forward. Guidewire provides this behavior, as otherwise, if an error occurs, the user who completes the activity sees the error, which is possibly confusing for that user.
  • If you invoke a workflow TRIGGER from code that does not necessarily care whether there was a failure in the workflow, you need to invoke the TRIGGER asynchronously. (You do this by setting the synchronous value in the workflow method to false.) That way, the workflow advances in the background and any errors it encounters force the workflow into the Error state. The exception does not affect the caller code. However, the calling code creates an exception if it tries to invoke an unavailable or non-existent workflow TRIGGER. Messaging plugins, in particular, need to always invoke triggers asynchronously.