<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Answers to: Is it possible to find the ICase that has lead to another ICase creation?</title><link>https://answers.axonivy.com/questions/1220/is-it-possible-to-find-the-icase-that-has-lead-to-another-icase-creation</link><description>&lt;p&gt;Hi everybody!&lt;/p&gt;
&lt;p&gt;I have a process which triggers another process start through a trigger step.
The first process has a related ICase (ivy.case) and the 2d started process belongs to another ICase.
We could consider in such a situation that the first ICase is the "ancestor" of the second one.
Is there a possibility to get a reference to the "ancestor" ICase from the second one?
Especially in a WorkflowEvent Listener like the one stated in this question: &lt;a href="http://answers.axonivy.com/questions/1193/listen-to-process-case-start-and-task-creation-start"&gt;listen-to-process-case-start-and-task-creation-start&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;A very convenient way would be something like:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;IWorkflowEvent createEvent = wfManager.findWorkflowEvent(event.getId());
if (createEvent.getEventKind() != WorkflowEventKind.EVENT_CREATE_CASE) {
return;
}
ICase newCase = createEvent.getCase();
newCase.getAncestorICase() // null if no ancestor, the ICase from which this newCase has been triggered
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Thanks a lot in advance!
Cheers
Emmanuel&lt;/p&gt;</description><atom:link href="https://answers.axonivy.com/questions/1220/is-it-possible-to-find-the-icase-that-has-lead-to-another-icase-creation" rel="self"></atom:link><language>en</language><lastBuildDate>Wed, 11 Mar 2015 20:37:48 -0400</lastBuildDate><item><title>Answer by Reto Weiss</title><link>https://answers.axonivy.com/questions/1220/is-it-possible-to-find-the-icase-that-has-lead-to-another-icase-creation/1223</link><description>&lt;p&gt;You can use the following code to get ancestor case from a case:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;ICase ancestorCase = newCase.getCreatorTask().getCase();
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The method &lt;code&gt;getCreatorTask()&lt;/code&gt; returns the task in which the trigger step was called. The case of this task is the ancestor case.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Reto Weiss</dc:creator><pubDate>Wed, 11 Mar 2015 20:37:48 -0400</pubDate><guid>https://answers.axonivy.com/questions/1220/is-it-possible-to-find-the-icase-that-has-lead-to-another-icase-creation/1223</guid></item></channel></rss>