Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events

Workflow is still running even after step showing as completed.


Adobe Champion

Workflow steps show completed. But still it is showing as 'Running' in the workflow instances?

Tried adding the step as in this post - https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/custom-workflow-instance-a... , added dam update workflow step as last step, still this is not fixed.



Please find below the code from my workflow


@component(name = "TestMove operation", service = WorkflowProcess.class, property = {
"process.label=Move operation" })
public class MoveOperation extends GenericWorkflowProcess {

private ResourceResolverFactory resourceResolverFactory;

private TestService service;

public void execute(WorkItem workItem, WorkflowSession workflowSession, MetaDataMap metaDataMap)
throws WorkflowException {
final WorkflowData workflowData = workItem.getWorkflowData();
final String assetPath = workflowData.getPayload().toString();
try (ResourceResolver resolver = resourceResolverFactory
.getServiceResourceResolver(ServiceUser.SERVICE_USER.getAuthMap())) {
Long serialValue;
Resource resource = resolver.getResource(assetPath);
Resource metadataResource = resource.getChild(Constants.JCR_CONTENT_METADATA_WITHOUT_SLASH);
ValueMap properties = ResourceUtil.getValueMap(metadataResource);
serialValue = properties.get(Constants.ID,Long.class);
if ((Objects.nonNull(serialValue))) {
Resource rootPathResource = resolver.getResource(Constants.ROOT_PATH);
service.moveAsset(resource, serialValue, resolver, rootPathResource, Constants.ROOT_PATH);
this.persistData(workItem, workflowSession, Constants.OPERATION_COMPLETED, true);
} catch (LoginException | PersistenceException e) {
log.error("Unable to login or modify/add property as '{}'", ServiceUser.SERVICE_USER, e);



I checked inside /var path and workflowitem node shows all status as completed. But the main parent node status is showing as RUNNING.




Anyone has faced this issue or have any leads?

6 Replies


Community Advisor

Hello @P_V_Nair 

Can you please cross-check, if Handler Advance is configured for the Workflow Step?


Then it will automatically advance to next step.


Please refer to https://experienceleague.adobe.com/docs/experience-manager-64/developing/extending-aem/extending-wor...

Aanchal Sikka


Level 4

Hi @P_V_Nair ,

Did you try to complete workflow in your custom workflow process step. 



// querying work items
WorkItem[] workItems = wfSession.getActiveWorkItems();
WorkItem workItem = wfSession.getWorkItem(id);

// getting routes
List<Route> routes = wfSession.getRoutes(workItem);

// completing or advancing to the next step
wfSession.complete(workItem, routes.get(0));

//optionaly terminate the current workflow programmatically



Note: Please ensure that Handler Advance is checked and your workflow model is synced after edit. 



Reference https://experienceleague.adobe.com/docs/experience-manager-65/developing/extending-aem/extending-wor... 


Adobe Champion

@aanchal-sikka @akashdeepAEM @Nikita___Garg I could see that workflows are still in running status and one thing I noticed which is contributing to this is that, after every deployment ,the green check in the workflow is going and it is not synced.



Employee Advisor

hi @P_V_Nair ,


May I know how many workflows are in running state in the existing instance?


Whether this is happening with this workflow only or others as well?



Nikita Garg