Getting Process Definition Name

Hi,

Is there any way to get the Process Definition Name using delegate execution.

Eg. execution.somemethod()

Hello @Anmol_Gupta ,

I think the execution only refers to the process definition id.

Anyway, the delegate execution allows you to query process engine services.

The Repository service has a method to query a process definition. The id as only parameter will return you a single result of ProcessDefinition. This contains the required information.

I hope this helps

Jonathan

2 Likes

Hi @Anmol_Gupta ,

the previous post already described a possible approach.
I would like to add a short code sample on how to work with the process engine and its services from within delegates:

public class ProcessDefinitionNameDelegate implements JavaDelegate {

    @Override
    public void execute(DelegateExecution execution) throws Exception {
        RepositoryService repositoryService = execution.getProcessEngineServices().getRepositoryService();
        ProcessDefinition definition = repositoryService.getProcessDefinition(execution.getProcessDefinitionId());
        String definitionName = definition.getName();
    }
}

Kind regards
Adagatiya

3 Likes

Thanks @jonathan.lukas @Adagatiya , for the help. I was able to implement the same. :slight_smile:

2 Likes