Document UI Refresh after Task creation

Hi

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.

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.

My code is following:


public void startWorkflow() throws Exception {
      automationService = getAutomationService();
      DocumentModel doc = navigationContext.getCurrentDocument();
      OperationContext ctx = new OperationContext(coreSession);
      ctx.setInput(doc);
      Map

Another thing that I tried was to create a EventHandler (in Nuxeo Studio) triggered by any Document modification, as following:


1)Run Script ->
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");

I'm not sure if there are another ways to do that and if this is a Nuxeo error, or not. Please, help me.

Thanks.

0 votes

1 answers

2817 views

ANSWER



The solution was to raise an especific event: TaskEventNames.WORKFLOW_NEW_STARTED

I removed all events on my class “startWorkflow()” and added only the evente above.

I removed also the Nuxeo Studio Event Handler (Run Script).

1 votes