How Can I solve this problem related to init workflow instances?

Hi, I have designed a workflow in my nuxeo studio : wTest, this workflow has first user task and the assignee property in this task has this value: @{WorkflowVariables["user_assigned"] == "" ? "user_group" : WorkflowVariables["user_assigned"]}, with this configuration, first time the task is assigned to default group “user_group” and if there is a reject, the task is assgined to last user assigned.

I want to create instance but without start it automatically, then I use your method createNewInstance with startInstance parameter in false:

createNewInstance(final String routeModelId,
            final List<String> docIds, final Map<String, Serializable> map,
            CoreSession session, final boolean startInstance)

With the parameter returned, I search documentRoute and using my custom method I want to start the instance, in my method I did this:

protected void startInstance(final DocumentRoute route,
        final Map<String, Serializable> map, CoreSession session) {
    try {
        new UnrestrictedSessionRunner(session) {
            public void run() throws ClientException {
                        new HashMap<String, Serializable>());
                DocumentRoutingEngineService routingEngine = Framework
                routingEngine.start(route, map, session);

            protected void fireEvent(String eventName,
                    Map<String, Serializable> eventProperties) {
                DocumentEventContext envContext = new DocumentEventContext(
                        session, session.getPrincipal(),
                EventProducer eventProducer = Framework
                try {
                } catch (ClientException e) {
                    throw new ClientRuntimeException(e);

    } catch (ClientException e) {
        throw new RuntimeException(e);

I believe this is the same thing but in two parts, what happens is that I want create the instance, set a value into map variable before start automatically. Now when I create and start instance automatically with your method createNewInstance, this works perfectly but when I want to create the instance, set value to map and after start it with my method, this error is throws in server log:

Caused by: org.nuxeo.ecm.platform.routing.api.exception.DocumentRouteException: Can not evaluate task assignees from WorkflowVariables["user_assigned"] == "" ? "user_group" : WorkflowVariables["user_assigned"]
    at org.nuxeo.ecm.platform.routing.core.impl.GraphNodeImpl.evaluateTaskAssignees(
    at org.nuxeo.ecm.platform.routing.core.impl.GraphRunner.createTask(
    at org.nuxeo.ecm.platform.routing.core.impl.GraphRunner.runGraph(

How can I do that?, Create instance, set a value inside of map, start instance and to prevent this error. In another workflows, it works perfectly but the assignes values are statics and not expresions.

0 votes

1 answers



Hi, we have replaced our ternary expresion

1-@{WorkflowVariables["user_assigned"] == "" ? "user_group" : WorkflowVariables["user_assigned"]}


2-@{WorkflowVariables["user_assigned"] == empty ? "user_group" : WorkflowVariables["user_assigned"]}

Why my old expresion (1) worked perfectly and now with my custom changes, we have to use expression (2)? Resp: We dont know :S

0 votes