KBEC-00249 - Retreiving Transition History in a Workflow

Summary

How can I tell which states were called, and which transitions were taken. A view such as:

Start \-> State 2 (succeeded) \-> State 3 (succeeded) \-> State 4 (failed) \-> End

 

Solution

Use the findObjects API on logEntry, and the filter with containerName equal to your workflowName. Something like:

$[/projects/EC-Admin/scripts/perlHeader]
$[/projects/EC-Admin/scripts/perlLib]
 
my $wkfName="workflow_222_201308090956";
 
# create filterList
my @filterList;
# get only log associated to my workflow
 
push (@filterList, {"propertyName" => "containerName",
                    "operator" => "equals",
                    "operand1" => "workflow_222_201308090956"});
push (@filterList, {"propertyName" => "containerType",
                    "operator" => "equals",
                    "operand1" => "workflow"});
 
my ($success, $xPath) = InvokeCommander("", "findObjects", "logEntry",
                                        {maxIds => 5000,
                                         filter => \\@filterList ,
                                         sort => [ {propertyName => "time",  order => "ascending"} \]});

It should return a number of objects like:

<object>
  <objectId>logEntry-122325</objectId>
  <logEntry>
    <logEntryId>122325</logEntryId>
    <container>workflow-222</container>
    <containerName>workflow_222_201308090956</containerName>
    <message>Invoking the sub-job for state 'Test'</message>
    <principal>project: Training_user</principal>
    <severity>INFO</severity>
    <subject>state-1319</subject>
    <subjectName>Test</subjectName>
    <time>2013-08-09T16:56:29.586Z</time>
  </logEntry>
</object>
<object>
  <objectId>logEntry-122328</objectId>
  <logEntry>
    <logEntryId>122328</logEntryId>
    <container>workflow-222</container>
    <containerName>workflow_222_201308090956</containerName>
    <message>The sub-job 'job_34687_201308090956' for state 'Test' has completed</message>
    <principal>project: Training_user</principal>
    <severity>INFO</severity>
    <subject>state-1319</subject>
    <subjectName>Test</subjectName>
    <time>2013-08-09T16:56:29.788Z</time>
  </logEntry> </object>

Applies to

  • Product versions: All
  • OS versions: Supported platforms
Have more questions? Submit a request

Comments

Powered by Zendesk