{"id":640,"date":"2017-11-30T21:16:46","date_gmt":"2017-11-30T20:16:46","guid":{"rendered":"http:\/\/h2916922.stratoserver.net:8084\/?p=640"},"modified":"2017-12-04T17:30:23","modified_gmt":"2017-12-04T16:30:23","slug":"asynchronously-emitting-from-a-scriptadapter","status":"publish","type":"post","link":"https:\/\/www.ivojonker.nl\/?p=640","title":{"rendered":"Asynchronously emitting from a scriptadapter"},"content":{"rendered":"<p>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?<\/p>\n<p>Its quite easy, and it&#8217;s done by:<\/p>\n<ol>\n<li>Disabling the default outgoing payload<\/li>\n<li>Manually call for an emit by calling:<\/li>\n<\/ol>\n<pre class=\"lang:js decode:true\">this.onPublishEvent(\"icm.SendEventPayload\",payload);<\/pre>\n<p>&nbsp;<\/p>\n<p>While this may seem like a trivial functionality, it can actually be used to fix challenges such as:<\/p>\n<ol>\n<li>Emitting a document\/folder\/task\/case(editable) that not yet has its full attributes retrieved. Simply call the retrieveAttributes before emitting.<\/li>\n<li>Split up payloads by wiring, e.g. handle each result of an ecm.model.SearchQuery.<br \/>\n(for each result -&gt; emit wire -&gt; show document in viewer)<\/li>\n<li>Waits &amp; polling. E.g. Wait for a certain event to happen, then finally emit.<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<p>Useful, right?<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[4,7,5],"class_list":["post-640","post","type-post","status-publish","format-standard","hentry","category-geen-categorie","tag-case-manager","tag-icm","tag-page-builder"],"_links":{"self":[{"href":"https:\/\/www.ivojonker.nl\/index.php?rest_route=\/wp\/v2\/posts\/640","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ivojonker.nl\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ivojonker.nl\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ivojonker.nl\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ivojonker.nl\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=640"}],"version-history":[{"count":1,"href":"https:\/\/www.ivojonker.nl\/index.php?rest_route=\/wp\/v2\/posts\/640\/revisions"}],"predecessor-version":[{"id":641,"href":"https:\/\/www.ivojonker.nl\/index.php?rest_route=\/wp\/v2\/posts\/640\/revisions\/641"}],"wp:attachment":[{"href":"https:\/\/www.ivojonker.nl\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=640"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ivojonker.nl\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=640"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ivojonker.nl\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=640"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}