<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How Can I solve this problem related to init workflow instances? in Nuxeo Forum</title>
    <link>https://connect.hyland.com/t5/nuxeo-forum/how-can-i-solve-this-problem-related-to-init-workflow-instances/m-p/313576#M577</link>
    <description>&lt;P&gt;Hi, we have replaced our ternary expresion&lt;/P&gt;
&lt;P&gt;1-&lt;CODE&gt;@{WorkflowVariables["user_assigned"] == "" ? "user_group" : WorkflowVariables["user_assigned"]}&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;with&lt;/P&gt;
&lt;P&gt;2-&lt;CODE&gt;@{WorkflowVariables["user_assigned"] == empty ? "user_group" : WorkflowVariables["user_assigned"]}&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;Why my old expresion (1) worked perfectly and now with my custom changes,  we have to use expression (2)?
Resp: We dont know :S&lt;/P&gt;</description>
    <pubDate>Mon, 22 Jul 2013 23:13:53 GMT</pubDate>
    <dc:creator>geekonspace</dc:creator>
    <dc:date>2013-07-22T23:13:53Z</dc:date>
    <item>
      <title>How Can I solve this problem related to init workflow instances?</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/how-can-i-solve-this-problem-related-to-init-workflow-instances/m-p/313575#M576</link>
      <description>&lt;P&gt;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: &lt;CODE&gt;@{WorkflowVariables["user_assigned"] == "" ? "user_group" : WorkflowVariables["user_assigned"]}&lt;/CODE&gt;, 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.&lt;/P&gt;
&lt;P&gt;I want to create instance but without start it automatically, then I use your method createNewInstance with startInstance parameter in false:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;createNewInstance(final String routeModelId,
            final List&amp;lt;String&amp;gt; docIds, final Map&amp;lt;String, Serializable&amp;gt; map,
            CoreSession session, final boolean startInstance)
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;With the parameter returned, I search documentRoute and using my custom method I want to start the instance, in my method I did this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;protected void startInstance(final DocumentRoute route,
		final Map&amp;lt;String, Serializable&amp;gt; map, CoreSession session) {
	try {
		new UnrestrictedSessionRunner(session) {
			@Override
			public void run() throws ClientException {
				fireEvent(
						DocumentRoutingConstants.Events.beforeRouteStart
								.name(),
						new HashMap&amp;lt;String, Serializable&amp;gt;());
				DocumentRoutingEngineService routingEngine = Framework
						.getLocalService(DocumentRoutingEngineService.class);
				routingEngine.start(route, map, session);
			}

			protected void fireEvent(String eventName,
					Map&amp;lt;String, Serializable&amp;gt; eventProperties) {
				eventProperties
						.put(DocumentRoutingConstants.DOCUMENT_ELEMENT_EVENT_CONTEXT_KEY,
								route);
				eventProperties.put(
						DocumentEventContext.CATEGORY_PROPERTY_KEY,
						DocumentRoutingConstants.ROUTING_CATEGORY);
				DocumentEventContext envContext = new DocumentEventContext(
						session, session.getPrincipal(),
						route.getDocument());
				envContext.setProperties(eventProperties);
				EventProducer eventProducer = Framework
						.getLocalService(EventProducer.class);
				try {
					eventProducer.fireEvent(envContext.newEvent(eventName));
				} catch (ClientException e) {
					throw new ClientRuntimeException(e);
				}
			}

		}.runUnrestricted();
	} catch (ClientException e) {
		throw new RuntimeException(e);
	}
}
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;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:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;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(GraphNodeImpl.java:584)
	at org.nuxeo.ecm.platform.routing.core.impl.GraphRunner.createTask(GraphRunner.java:345)
	at org.nuxeo.ecm.platform.routing.core.impl.GraphRunner.runGraph(GraphRunner.java:228)
	at org.nuxeo.ecm.platform.routing.core.impl.GraphRunner.run(GraphRunner.java:75)
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;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.&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jul 2013 22:36:29 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/how-can-i-solve-this-problem-related-to-init-workflow-instances/m-p/313575#M576</guid>
      <dc:creator>geekonspace</dc:creator>
      <dc:date>2013-07-19T22:36:29Z</dc:date>
    </item>
    <item>
      <title>Re: How Can I solve this problem related to init workflow instances?</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/how-can-i-solve-this-problem-related-to-init-workflow-instances/m-p/313576#M577</link>
      <description>&lt;P&gt;Hi, we have replaced our ternary expresion&lt;/P&gt;
&lt;P&gt;1-&lt;CODE&gt;@{WorkflowVariables["user_assigned"] == "" ? "user_group" : WorkflowVariables["user_assigned"]}&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;with&lt;/P&gt;
&lt;P&gt;2-&lt;CODE&gt;@{WorkflowVariables["user_assigned"] == empty ? "user_group" : WorkflowVariables["user_assigned"]}&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;Why my old expresion (1) worked perfectly and now with my custom changes,  we have to use expression (2)?
Resp: We dont know :S&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jul 2013 23:13:53 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/how-can-i-solve-this-problem-related-to-init-workflow-instances/m-p/313576#M577</guid>
      <dc:creator>geekonspace</dc:creator>
      <dc:date>2013-07-22T23:13:53Z</dc:date>
    </item>
  </channel>
</rss>

