Issue in fetching the title of the current workflow step | Adobe Higher Education
Skip to main content
red_devil
March 7, 2021
Besvarat

Issue in fetching the title of the current workflow step

  • March 7, 2021
  • 2 svar
  • 1262 visningar

Hi,

 

I want to fetch the title and description of a dynamic participant step that I'm currently in. I tried using

workItem.getNode().getTitle() but it returns the title of the previous step and not the current one (dynamic participant step). Is there any way to fetch the details of the current step in workflows?

 

@arunpatidar@vijayalakshmi_s 

Det här ämnet har stängts för svar.
Bästa svar av Vijayalakshmi_S

Hi @red_devil,

I am able to reproduce the behavior you have mentioned. 

As part of debugging, could find that the workItem Id being in ParticipantChooser Implementation returns as VolatileWorkItem.

(You can log this line of code workItem.getId() -> VolatileWorkItem_node0_var_workflow_instances_server0_2021-03-08_sampleworkflow_10)

On a very high level, with this information could suspect that the details with respect to the workItem node like title, description is not accessible/not in the vicinity of ParticipantChooser implementation. 

Alternatively, you can consider use of  "Arguments" field  of Dynamic participant step to pass inputs along the lines of title/description.(which shall then be retrieved from MetaDataMap, third argument of getParticipant method)

While the same line of code - workItem.getNode().getTitle() being executed from process step will return its respective details (title as authored in process step)

Note : As the granite workflow implementation is hidden, couldn't arrive at the exact reason for this behavior.

2 svar

arunpatidar
Community Advisor
Community Advisor
March 7, 2021

Hi,

Try using WorkflowSession to get the current work item.

Arun Patidar
red_devil
red_devilSkribent
March 8, 2021
I tried using workflowSession.getActiveWorkItems() but this one also returns the previous step details. I tried to access the "/var/workflow/instances/<server>/<date>/<workflow_id>/workItems" but it also had the previous step details at the time I'm trying to fetch the dynamic participant step details
Vijayalakshmi_S
Level 10
March 8, 2021

Hi @red_devil,

I am able to reproduce the behavior you have mentioned. 

As part of debugging, could find that the workItem Id being in ParticipantChooser Implementation returns as VolatileWorkItem.

(You can log this line of code workItem.getId() -> VolatileWorkItem_node0_var_workflow_instances_server0_2021-03-08_sampleworkflow_10)

On a very high level, with this information could suspect that the details with respect to the workItem node like title, description is not accessible/not in the vicinity of ParticipantChooser implementation. 

Alternatively, you can consider use of  "Arguments" field  of Dynamic participant step to pass inputs along the lines of title/description.(which shall then be retrieved from MetaDataMap, third argument of getParticipant method)

While the same line of code - workItem.getNode().getTitle() being executed from process step will return its respective details (title as authored in process step)

Note : As the granite workflow implementation is hidden, couldn't arrive at the exact reason for this behavior.