<?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: Document UI Refresh after Task creation in Nuxeo Forum</title>
    <link>https://connect.hyland.com/t5/nuxeo-forum/document-ui-refresh-after-task-creation/m-p/321449#M8450</link>
    <description>&lt;P&gt;The solution was to raise an especific event: TaskEventNames.WORKFLOW_NEW_STARTED&lt;/P&gt;
&lt;P&gt;I removed all events on my class "startWorkflow()" and added only the evente above.&lt;/P&gt;
&lt;P&gt;I removed also the Nuxeo Studio Event Handler (Run Script).&lt;/P&gt;</description>
    <pubDate>Fri, 25 Jul 2014 15:31:14 GMT</pubDate>
    <dc:creator>SergioFerreira_</dc:creator>
    <dc:date>2014-07-25T15:31:14Z</dc:date>
    <item>
      <title>Document UI Refresh after Task creation</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/document-ui-refresh-after-task-creation/m-p/321448#M8449</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;I have a custom Document.
This Document has a custom Summary page. On the boton page area, we have to show the Document Tasks.
I have created a button, this button has to start a Workflow.
After push the button, I expect a new Task created for this Document.&lt;/P&gt;
&lt;P&gt;The problem is the page refresh.
The Workflow was correctly started, but the Task is not presented on the same Summary page.
I have to logout and login again in the Nuxeo to see my Task.&lt;/P&gt;
&lt;P&gt;My code is following:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;
public void startWorkflow() throws Exception {
      automationService = getAutomationService();
      DocumentModel doc = navigationContext.getCurrentDocument();
      OperationContext ctx = new OperationContext(coreSession);
      ctx.setInput(doc);
      Map&lt;STRING&gt; props = new HashMap&lt;STRING&gt;();
      automationService.run(ctx, "WF_MYWORKFLOW", props);

      doc.refresh();
      coreSession.save();

      //Here I am trying desperately to make a REFRESH
      DocumentModel documentParent = documentManager.getDocument(doc.getParentRef());
      Events.instance().raiseEvent(EventNames.DOCUMENT_CHANGED, documentParent);
      Events.instance().raiseEvent(EventNames.DOCUMENT_CHANGED, doc);
      Events.instance().raiseEvent(EventNames.DOCUMENT_CHILDREN_CHANGED, doc);
      doc.refresh(DocumentModel.REFRESH_ALL, null);
}
&lt;/STRING&gt;&lt;/STRING&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Another thing that I tried was to create a EventHandler (in Nuxeo Studio) triggered by any Document modification, as following:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;
1)Run Script -&amp;gt;
org.nuxeo.ecm.automation.jsf.OperationHelper.getWebActions().resetTabList();
org.nuxeo.ecm.automation.jsf.OperationHelper.getDocumentListManager().resetWorkingList(org.nuxeo.ecm.webapp.documentsLists.DocumentsListsManager.CURRENT_DOCUMENT_SELECTION);
org.nuxeo.ecm.automation.jsf.OperationHelper.getWebActions().resetCurrentTab();
org.nuxeo.ecm.automation.jsf.OperationHelper.getContentViewActions().resetAllContent();
org.nuxeo.ecm.automation.jsf.OperationHelper.getContentViewActions().resetAll();
org.nuxeo.ecm.automation.jsf.OperationHelper.getContentViewActions().refreshAndRewind("MissionsRootContent");
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I'm not sure if there are another ways to do that and if this is a Nuxeo error, or not.
Please, help me.&lt;/P&gt;
&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jul 2014 19:32:29 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/document-ui-refresh-after-task-creation/m-p/321448#M8449</guid>
      <dc:creator>SergioFerreira_</dc:creator>
      <dc:date>2014-07-22T19:32:29Z</dc:date>
    </item>
    <item>
      <title>Re: Document UI Refresh after Task creation</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/document-ui-refresh-after-task-creation/m-p/321449#M8450</link>
      <description>&lt;P&gt;The solution was to raise an especific event: TaskEventNames.WORKFLOW_NEW_STARTED&lt;/P&gt;
&lt;P&gt;I removed all events on my class "startWorkflow()" and added only the evente above.&lt;/P&gt;
&lt;P&gt;I removed also the Nuxeo Studio Event Handler (Run Script).&lt;/P&gt;</description>
      <pubDate>Fri, 25 Jul 2014 15:31:14 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/document-ui-refresh-after-task-creation/m-p/321449#M8450</guid>
      <dc:creator>SergioFerreira_</dc:creator>
      <dc:date>2014-07-25T15:31:14Z</dc:date>
    </item>
  </channel>
</rss>

