I'm starting a workflow programmatically and want to save the id of the newly created route document in a variable in my workflow. I have done this:
String workflowId = startWorkflow(workflowName,list,map); //my custom method returns workflowId
DocumentModel doc = documentManager.getDocument(new IdRef(workflowId));
GraphRoute route= doc.getAdapter(GraphRoute.class);
Map<String, Serializable> mapRoute = route.getVariables();
mapRoute.put(BusinessConstantes.DOCUMENT_ROUTE_ID, workflowId);
route.setVariables(mapRoute);
but in the line where I try to assign the variables (route.setVariables(mapRoute);) the following error is displayed:
Caused by: org.nuxeo.ecm.core.api.DocumentSecurityException: Privilege 'WriteProperties' is not granted to 'boxoffice'
at org.nuxeo.ecm.core.api.AbstractSession.checkPermission (AbstractSession.java: 282)
at org.nuxeo.ecm.core.api.AbstractSession.saveDocument (AbstractSession.java: 1859)
at
... 122 more
Caused by: org.nuxeo.ecm.core.api.ClientRuntimeException: org.nuxeo.ecm.core.api.DocumentSecurityException: Privilege 'WriteProperties' is not granted to 'box office'
at
at org.nuxeo.ecm.platform.routing.core.impl.GraphRouteImpl.setVariables (GraphRouteImpl.java: 139)
User 'boxoffice' is not administrator and he is not assigned to workflow but I want any user can start workflow and also save workflowId in workflow variables.
How Can I do?