Asynchronously emitting from a scriptadapter

The regular use of a IBM CaseManager ScriptAdapter allows you to specify a payload that is (synchronously) emitted after it is triggered by an incoming event. But, did you know it is also an option to asynchronously emit the payload?

Its quite easy, and it’s done by:

  1. Disabling the default outgoing payload
  2. Manually call for an emit by calling:
this.onPublishEvent("icm.SendEventPayload",payload);

 

While this may seem like a trivial functionality, it can actually be used to fix challenges such as:

  1. Emitting a document/folder/task/case(editable) that not yet has its full attributes retrieved. Simply call the retrieveAttributes before emitting.
  2. Split up payloads by wiring, e.g. handle each result of an ecm.model.SearchQuery.
    (for each result -> emit wire -> show document in viewer)
  3. Waits & polling. E.g. Wait for a certain event to happen, then finally emit.

 

Useful, right?

Leave a Reply

Your email address will not be published. Required fields are marked *