<?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 Rest API: create process with item in Alfresco Forum</title>
    <link>https://connect.hyland.com/t5/alfresco-forum/rest-api-create-process-with-item/m-p/119896#M32970</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am currently trying to create a process by using the REST API : HTTP POST request at /alfresco/api/-default-/public/workflow/versions/1/processes with the following data:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;PRE&gt;{
"processDefinitionKey": "mbWfAddContent",
"variables": {
&amp;nbsp; &amp;nbsp; "bpm_assignee": "...",
&amp;nbsp; &amp;nbsp; "bpm_sendEMailNotifications": true,
&amp;nbsp; &amp;nbsp; "bpm_workflowPriority": 0,
&amp;nbsp; &amp;nbsp; "mbwf_contentType": "Recording"
}&lt;/PRE&gt;&lt;SPAN&gt;but it fails with error 500 and this message "Incorrect number of document attached to this workflow. Only one document is accepted". This is because the workflow's&amp;nbsp;startEvent script has&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;PRE&gt;if(bpm_package.children.length == 1)
    .....
else&lt;BR /&gt;    throw new Error("Incorrect number of document attached to this workflow. Only one document is accepted");&lt;/PRE&gt;&lt;SPAN&gt;Is there a way to add items to a process directly in the process creation request ?&lt;BR /&gt;I cannot use the&amp;nbsp;POST request to&amp;nbsp;​alfresco/api/-default-/public/workflow/versions/1//processes​/{processId}​/items because the process does not exist yet at this point, so it does not have an id yet.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Thanks !&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Fri, 06 May 2022 17:00:23 GMT</pubDate>
    <dc:creator>EricLemanissie</dc:creator>
    <dc:date>2022-05-06T17:00:23Z</dc:date>
    <item>
      <title>Rest API: create process with item</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/rest-api-create-process-with-item/m-p/119896#M32970</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am currently trying to create a process by using the REST API : HTTP POST request at /alfresco/api/-default-/public/workflow/versions/1/processes with the following data:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;PRE&gt;{
"processDefinitionKey": "mbWfAddContent",
"variables": {
&amp;nbsp; &amp;nbsp; "bpm_assignee": "...",
&amp;nbsp; &amp;nbsp; "bpm_sendEMailNotifications": true,
&amp;nbsp; &amp;nbsp; "bpm_workflowPriority": 0,
&amp;nbsp; &amp;nbsp; "mbwf_contentType": "Recording"
}&lt;/PRE&gt;&lt;SPAN&gt;but it fails with error 500 and this message "Incorrect number of document attached to this workflow. Only one document is accepted". This is because the workflow's&amp;nbsp;startEvent script has&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;PRE&gt;if(bpm_package.children.length == 1)
    .....
else&lt;BR /&gt;    throw new Error("Incorrect number of document attached to this workflow. Only one document is accepted");&lt;/PRE&gt;&lt;SPAN&gt;Is there a way to add items to a process directly in the process creation request ?&lt;BR /&gt;I cannot use the&amp;nbsp;POST request to&amp;nbsp;​alfresco/api/-default-/public/workflow/versions/1//processes​/{processId}​/items because the process does not exist yet at this point, so it does not have an id yet.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Thanks !&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 06 May 2022 17:00:23 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/rest-api-create-process-with-item/m-p/119896#M32970</guid>
      <dc:creator>EricLemanissie</dc:creator>
      <dc:date>2022-05-06T17:00:23Z</dc:date>
    </item>
  </channel>
</rss>

