Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

Custom workflow does not appears in process list. AEM 6.2

Avatar

Level 1

Hello:

I have the next problem, I created a custom workflow process and it does not appears on the process list on the dropdown field ( process step) ,

but If I change the version of :processlist.PNG

<plugin>

          <groupId>org.apache.felix</groupId>

          <artifactId>maven-scr-plugin</artifactId>

          <version>1.23.0</version>

  </plugin>

from 1.23.0 to 1.20.0 this appears correctly and works.

I tried this answer from this forum but it does not work for me Custom Workflow Step Not Showing up in Process List Dropdown

I tried this link also AEM Developer Learning : July 2017​  like possible solution ( it is the most recent article I have found) but this does not work for maven-scr-plugin version 1.23.0

We need to keep maven-scr-plugin on version 1.23.0 to guarantee the stability of our project.

Here is an example of Workflow process we are using.

import org.apache.felix.scr.annotations.Component;

import org.apache.felix.scr.annotations.Properties;

import org.apache.felix.scr.annotations.Property;

import org.apache.felix.scr.annotations.Service;

import org.osgi.framework.Constants;

import org.slf4j.Logger;

import org.slf4j.LoggerFactory;

import com.day.cq.workflow.WorkflowException;

import com.day.cq.workflow.WorkflowSession;

import com.day.cq.workflow.exec.WorkItem;

import com.day.cq.workflow.exec.WorkflowProcess;

import com.day.cq.workflow.metadata.MetaDataMap;

@Component

@Service

@Properties({

    @Property(name = Constants.SERVICE_DESCRIPTION, value = "Testing workflow"),

    @Property(name = Constants.SERVICE_VENDOR, value = "TEST"),

    @Property(name = "process.label", value = "Testing workflow test") })

public class WorkFlowTest implements WorkflowProcess{

    private static final Logger LOG = LoggerFactory.getLogger(WorkFlowTest.class);

   

    @Override

    public void execute(WorkItem arg0, WorkflowSession arg1, MetaDataMap arg2) throws WorkflowException {

        // TODO Auto-generated method stub

        LOG.info("Hellooooooooooooooooooo testing !!!!!!!");

    }

}

There is any way to implement a custom Workflow Process without changing the version of maven-scr-plugin?

Thank you.

1 Accepted Solution

Avatar

Correct answer by
Level 1

Finally I figured out what was missing:

Was missing add the line @Property(name = "service.pid", value = "com.test.yourpackage.name.WorkFlowTest"), so the Java class will be like it is:

  1. import org.apache.felix.scr.annotations.Component; 
  2. import org.apache.felix.scr.annotations.Properties; 
  3. import org.apache.felix.scr.annotations.Property; 
  4. import org.apache.felix.scr.annotations.Service; 
  5. import org.osgi.framework.Constants; 
  6. import org.slf4j.Logger; 
  7. import org.slf4j.LoggerFactory; 
  8.  
  9. import com.day.cq.workflow.WorkflowException; 
  10. import com.day.cq.workflow.WorkflowSession; 
  11. import com.day.cq.workflow.exec.WorkItem; 
  12. import com.day.cq.workflow.exec.WorkflowProcess; 
  13. import com.day.cq.workflow.metadata.MetaDataMap; 
  14.  
  15. @Component 
  16. @Service 
  17. @Properties({  
  18.     @Property(name = Constants.SERVICE_DESCRIPTION, value = "Testing workflow"), 
  19.     @Property(name = Constants.SERVICE_VENDOR, value = "TEST"),
  20.     @Property(name = "service.pid", value = "com.test.yourpackage.name.WorkFlowTest") 
  21.     @Property(name = "process.label", value = "Testing workflow test") }) 
  22.  
  23.  
  24. public class WorkFlowTest implements WorkflowProcess{ 
  25.  
  26.     private static final Logger LOG = LoggerFactory.getLogger(WorkFlowTest.class); 
  27.      
  28.     @Override 
  29.     public void execute(WorkItem arg0, WorkflowSession arg1, MetaDataMap arg2) throws WorkflowException { 
  30.         // TODO Auto-generated method stub 
  31.         LOG.info("Hellooooooooooooooooooo testing !!!!!!!"); 
  32.     } 
  33.  

The solution was the line number 20.

View solution in original post

5 Replies

Avatar

Level 10

Did you try generating your workflow step by using Maven 10 Archetype - which is the recommended version to use for 6.2.

Avatar

Level 10

I will test that too right now on AEM 6.2 and post back my findings.

Avatar

Correct answer by
Level 1

Finally I figured out what was missing:

Was missing add the line @Property(name = "service.pid", value = "com.test.yourpackage.name.WorkFlowTest"), so the Java class will be like it is:

  1. import org.apache.felix.scr.annotations.Component; 
  2. import org.apache.felix.scr.annotations.Properties; 
  3. import org.apache.felix.scr.annotations.Property; 
  4. import org.apache.felix.scr.annotations.Service; 
  5. import org.osgi.framework.Constants; 
  6. import org.slf4j.Logger; 
  7. import org.slf4j.LoggerFactory; 
  8.  
  9. import com.day.cq.workflow.WorkflowException; 
  10. import com.day.cq.workflow.WorkflowSession; 
  11. import com.day.cq.workflow.exec.WorkItem; 
  12. import com.day.cq.workflow.exec.WorkflowProcess; 
  13. import com.day.cq.workflow.metadata.MetaDataMap; 
  14.  
  15. @Component 
  16. @Service 
  17. @Properties({  
  18.     @Property(name = Constants.SERVICE_DESCRIPTION, value = "Testing workflow"), 
  19.     @Property(name = Constants.SERVICE_VENDOR, value = "TEST"),
  20.     @Property(name = "service.pid", value = "com.test.yourpackage.name.WorkFlowTest") 
  21.     @Property(name = "process.label", value = "Testing workflow test") }) 
  22.  
  23.  
  24. public class WorkFlowTest implements WorkflowProcess{ 
  25.  
  26.     private static final Logger LOG = LoggerFactory.getLogger(WorkFlowTest.class); 
  27.      
  28.     @Override 
  29.     public void execute(WorkItem arg0, WorkflowSession arg1, MetaDataMap arg2) throws WorkflowException { 
  30.         // TODO Auto-generated method stub 
  31.         LOG.info("Hellooooooooooooooooooo testing !!!!!!!"); 
  32.     } 
  33.  

The solution was the line number 20.

Avatar

Level 10

Hi,

Eventually it is working  without property - service.pid as per the article. We have tested article many times.

Also, We will add that line no 20 in HELPX article when smacdonald2008 back to work!!

Thanks,

Ratna.