<?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 to update programmatically workflow variable after create it in Nuxeo Forum</title>
    <link>https://connect.hyland.com/t5/nuxeo-forum/how-to-update-programmatically-workflow-variable-after-create-it/m-p/323928#M10929</link>
    <description>&lt;P&gt;Thanks!!!!&lt;/P&gt;</description>
    <pubDate>Fri, 12 Jul 2013 20:19:13 GMT</pubDate>
    <dc:creator>geekonspace</dc:creator>
    <dc:date>2013-07-12T20:19:13Z</dc:date>
    <item>
      <title>How to update programmatically workflow variable after create it</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/how-to-update-programmatically-workflow-variable-after-create-it/m-p/323926#M10927</link>
      <description>&lt;P&gt;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:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;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&amp;lt;String, Serializable&amp;gt; mapRoute = route.getVariables();                
mapRoute.put(BusinessConstantes.DOCUMENT_ROUTE_ID, workflowId);
route.setVariables(mapRoute);  
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;but in the line where I try to assign the variables (route.setVariables(mapRoute);) the following error is displayed:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;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)
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;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.&lt;/P&gt;
&lt;P&gt;How Can I do?&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jul 2013 22:06:41 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/how-to-update-programmatically-workflow-variable-after-create-it/m-p/323926#M10927</guid>
      <dc:creator>geekonspace</dc:creator>
      <dc:date>2013-07-11T22:06:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to update programmatically workflow variable after create it</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/how-to-update-programmatically-workflow-variable-after-create-it/m-p/323927#M10928</link>
      <description>&lt;P&gt;Task document and Workflow document are created by the system profile and are hidden for all users.
To access to these documents, you have to use UnrestrictedSessionRunner:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;public class AddIdInWorkflow extends UnrestrictedSessionRunner {
    private final DocumentModel worflow;
    private final String value;

    public AddIdInWorkflow(CoreSession session,
            DocumentModel worflow, String value) {
        super(session);
        this.worflow = worflow;
        this.value = value;
    }

    @Override
    public void run() throws ClientException {
        worflow.setPropertyValue("myschema:id", value);
        session.saveDocument(workflow);
        session.save();
    }

}
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And then to execute the modification:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;new AddIdInWorkflow(session, workflow, value).runUnrestricted()
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 12 Jul 2013 08:28:00 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/how-to-update-programmatically-workflow-variable-after-create-it/m-p/323927#M10928</guid>
      <dc:creator>Benjamin_Jalon1</dc:creator>
      <dc:date>2013-07-12T08:28:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to update programmatically workflow variable after create it</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/how-to-update-programmatically-workflow-variable-after-create-it/m-p/323928#M10929</link>
      <description>&lt;P&gt;Thanks!!!!&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jul 2013 20:19:13 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/how-to-update-programmatically-workflow-variable-after-create-it/m-p/323928#M10929</guid>
      <dc:creator>geekonspace</dc:creator>
      <dc:date>2013-07-12T20:19:13Z</dc:date>
    </item>
  </channel>
</rss>

