<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">
<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>
                                <td>
                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="https://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>
                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px; -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
How to get data from Multiple-instance subprocess node?
</h3>
<span style="margin-bottom: 10px;">
created by <a href="https://community.jboss.org/people/taurus">Evgene Ostapenko</a> in <i>jBPM</i> - <a href="https://community.jboss.org/message/725589#725589">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">
<div class="jive-rendered-content"><p>I have a Multiple-instance node for which i have specified CollectionExpression and VariableName parameters:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>CollectionExpression: list</p><p>VariableName: item</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>After starting a system creates several subproceses. Each of them can access its own<span style="font-family: 'Lucida Grande', Geneva, Verdana, Arial, sans-serif; font-size: 12px; text-align: justify;"> element from the collection by using a variable given as VariableName. I pass an Object elements in collection and use such parameter mapping:</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><span style="font-family: 'Lucida Grande', Geneva, Verdana, Arial, sans-serif; font-size: 12px; text-align: justify;"><br/></span></p><table border="1" cellpadding="3" cellspacing="0" class="jiveBorder" style="width: 100%; border: 1px solid #000000;"><tbody><tr><th align="center" style="border:1px solid black;border: 1px solid #000000;background-color: #6690bc;" valign="middle"><span style="color: #ffffff;"><strong style="text-align: justify; font-size: 12px; font-family: 'Lucida Grande', Geneva, Verdana, Arial, sans-serif;">Sub-process variable</strong></span></th><th align="center" style="border:1px solid black;border: 1px solid #000000;background-color: #6690bc;" valign="middle"><span style="color: #ffffff;"><strong>Process variable</strong></span></th></tr><tr><td style="border:1px solid black;border: 1px solid #000000;"><span style="font-family: 'Lucida Grande', Geneva, Verdana, Arial, sans-serif; font-size: 12px; text-align: justify;">username                    </span></td><td style="border:1px solid black;border: 1px solid #000000;">item.username</td></tr></tbody></table><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><span style="font-family: 'Lucida Grande', Geneva, Verdana, Arial, sans-serif; font-size: 12px; text-align: justify;">It works. I can use "username" in the subprocess. But when i tried to return its value to the main process and set a result mapping</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><table border="1" cellpadding="3" cellspacing="0" class="jiveBorder" style="width: 100%; border: 1px solid #000000;"><tbody><tr><th align="center" style="border:1px solid black;border: 1px solid #000000;background-color: #6690bc;" valign="middle"><span style="color: #ffffff;"><strong style="text-align: justify; font-size: 12px; font-family: 'Lucida Grande', Geneva, Verdana, Arial, sans-serif;">Sub-process variable</strong></span></th><th align="center" style="border:1px solid black;border: 1px solid #000000;background-color: #6690bc;" valign="middle"><span style="color: #ffffff;"><strong>Process variable</strong></span></th></tr><tr><td style="border:1px solid black;border: 1px solid #000000;"><span style="font-family: 'Lucida Grande', Geneva, Verdana, Arial, sans-serif; font-size: 12px; text-align: justify;">username                    </span></td><td style="border:1px solid black;border: 1px solid #000000;"><span style="font-family: 'Lucida Grande', Geneva, Verdana, Arial, sans-serif; font-size: 12px; text-align: justify;">item.username</span></td></tr></tbody></table><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><span style="font-family: 'Lucida Grande', Geneva, Verdana, Arial, sans-serif; font-size: 12px; text-align: justify;">i get the message at start of the application:</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><span style="font-family: 'Lucida Grande', Geneva, Verdana, Arial, sans-serif; font-size: 12px; text-align: justify;">There is no ID/IDREF binding for IDREF 'item.username'.</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>After executing a subprocess, exception happens:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><span style="color: #ff0000;">ould not find variable scope for variable item.username</span></p><p><span style="color: #ff0000;">when trying to complete SubProcess node Sub-Process</span></p><p><span style="color: #ff0000;">Continuing without setting variable.</span></p><p><span style="color: #ff0000;">Could not find variable scope for variable item.outcoming_doc_id</span></p><p><span style="color: #ff0000;">when trying to complete SubProcess node Sub-Process</span></p><p><span style="color: #ff0000;">Continuing without setting variable.</span></p><p><span style="color: #ff0000;">java.lang.NullPointerException</span></p><p><span style="color: #ff0000;">          at com.sample.BPMTaskHandler.executeWorkItem(BPMTaskHandler.java:32)</span></p><p><span style="color: #ff0000;">          at org.drools.process.instance.impl.DefaultWorkItemManager.internalExecuteWorkItem(DefaultWorkItemManager.java:70)</span></p><p><span style="color: #ff0000;">          at org.jbpm.workflow.instance.node.WorkItemNodeInstance.internalTrigger(WorkItemNodeInstance.java:105)</span></p><p><span style="color: #ff0000;">          at org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:122)</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><span style="font-family: 'Lucida Grande', Geneva, Verdana, Arial, sans-serif; font-size: 12px; text-align: justify;">How can i write a working result mapping in this case?<br/></span></p></div>
<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
<p style="margin: 0;">Reply to this message by <a href="https://community.jboss.org/message/725589#725589">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in jBPM at <a href="https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034">Community</a></p>
</div></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>