In Process I use another process using a Call Activity several times.
Do add some meaning to the model, I have different names for each call: “1st step”, “2nd step”, etc.
What I want now is to rename each of the tasks in the called process so the end user will understand what is beeing requested of him.
So instead of receiving several task called “Do This Task” in his inbox, he should be receiving “1st step - Do This Task”, “2nd step - Do This Task”, etc.
The problem is, contrary to tasks, processes and subprocesses do not have access to their own TaskInfo data, so its not possible to know which step they refer in the upper level process.
Is there a place in the Java API where this information can be extracted?
I have found a workaround: modifying the PRE_CALL IS flow service for each Call Activity on the upper process and calling the pub.monitor.process.instanceSteps:getStepDetails (had to fake status [1 - Started] and stepIteration [1] because I could not get those values anywhere) with the ProcessInstanceID and StepID and injecting the result in my own pipeline so it will appear as accessible data on each subprocess Task’s data.
Final code uses pub.monitor.process.modelSteps:getStepIDNames .
While trying pub.monitor.process.instanceSteps:getStepDetails I found that it goes in a race condition and sometimes does not return any values or errors.
I might not quite understand your use case, but this is what i’m guessing: You’d like your task instance to behave differently based on what step in the process it is associated with. In other words, you are using the same task type multiple times within a process, but its behavior should slightly change depending on the step in the process.
If i’m correct, then i’d recommend using Task Control Sets. Have a look at the on-line Task Designer documentation and refer to the section titled: “Working with Task Control Sets”. You can use different events and assignments to alter behavior and display text as needed.
Thank you for suggestion but I’m afraid it is not a very good fit in to this process.
I understand what you are proposing but in my present scenario I have some difficulty in using Task Control Sets.
To start, they are a second class citizen in the framework, cannot be defined and managed from a central place, only from within the Events and Assignments controls, which makes them very hard to document.
Secondly, they are very opaque from the point of view of Process Modeling, so its use must be very restrained (although you can make the exact same point with the usage of the IS services in PRECALL_ and POSTCALL_ services).
Attaching code to the PRECALL_, POSTCALL_, _InputMapService, _OutputMapService and _QueueTask calls, allows me to do data preparation which has no meaning in terms of the process model and still maintain a reasonably orchestrated development.
In the specific question of the StepName, my idea is to get the name of the step which is calling my task, on the top level process, so I can show it on the final tasks’s Custom ID to the user, to be better present the exact kind of work requested.
I also plan to use this as an input into Business Rules, but haven’t yet reached that point in the development.