Example asynchronous document storage failed Event Fired rule
Guidewire recommends that, in working with
asynchronous document storage, that you create an Event Fired rule to
handle the failure of the database to store a document properly. If a
document fails to store properly, PolicyCenter creates a FailedDocumentStore event on Document.
To be useful, you need to add the FailedDocumentStore event to a
messaging destination in messaging-config.xml.
For example, you can add this event to message destination 324, which
already tracks the DocumentStore
event.
You then need to create an event rule to process the event as you see fit. You can, for example:
- Email a notification message to the creator of the Document entity.
- Create an activity on the primary or root object.
- Attempt to correct the
document issues and create a new
DocumentStoremessage.
The following example rule illustrates a possible Event Fired rule to handle the failure of the database to store a document.
CONDITION (messageContext : entity.MessageContext):
return messageContext.DestID == 324 and messageContext.EventName == "FailedDocumentStore"
ACTION (messageContext : entity.MessageContext, actions : gw.Rules.Action):
var document = messageContext.Root as Document
var fixedIssue = false
var sendEmail = false
if (fixedIssue) {
messageContext.createMessage( "DocumentStore" )
}
else if (document.CreateUser.Contact.EmailAddress1 != null && sendEmail) {
gw.api.email.EmailUtil.sendEmailWithBody(document,
document.CreateUser.Contact.EmailAddress1,
document.CreateUser.Contact.getDisplayName(),
null, null, "Failed Document Store",
//CREATE MESSAGE BODY HERE )
}
See also
