Article Details
Id:11117
Product:finPOWER Connect
Type:NEW
Version:1.06.08
Opened:30/04/2013
Closed:30/04/2013
Released:28/05/2013
Job: J011531

Workflow Account document scripting; "GenerateMessage" event runs multiple times

Workflows, creating an Account document fires the "GenerateMessage" event multiple times.

NOTE: This is by design.

When an Email or SMS document is run as part of a Workflow it fires a "GenerateMessage" event. The initial call is to get the subject and message text - potentially overriding that defined on the document. Secondly, this event is fired for each relevant Client on the Account to personalise the message for that Client.

This means that you may wish to distinguish between the initial event call and subsequent Client personalisation calls.

The following code demonstrates the best method to achieve this:

If eventArgs.Exists("AccountClient") Then
  ' Subsequent calls from Workflow document to personalise for the Client
Else      
  ' Initial call to get subject and message
End If