Platform Explorer / Nuxeo Platform 6.0

Operation Document.Create

Create

Description

Create a new document in the input folder. You can initialize the document properties using the 'properties' parameter. The properties are specified as key=value pairs separated by a new line. The key used for a property is the property xpath. To specify multi-line values, you can use a \ character followed by a new line.

Example:

dc:title=The Document Title
dc:description=foo bar
. Returns the created document.

Usage example: creating a button that creates a new document of type Note, but copies specific fields of the currently select document.

  1. Fetch > Context document
  2. Execution context > Set context variable
    • Name: DocTitle
    • Value: @{Document.title} @{Document.versionLabel}
  3. Execution context > Set context variable
    • Name: DocDescription
    • Value: @{Document.description}
  4. Document > Get Parent
  5. Document > Create
  6. User Interface > Refresh
  7. User Interface > Add Info Message
    • Message: The document has been created

You can also find an example using this operation here: Add a "Create a new version of current module" button

Operation id Document.Create
Category Document
Label Create
Requires
Since

Parameters

Name Description Type Required Default value
type string yes  
name string no  
properties properties no  

Signature

Inputs document, documents
Outputs document, documents

Implementation information

Implementation class org.nuxeo.ecm.automation.core.operations.document.CreateDocument
Contributing component org.nuxeo.ecm.core.automation.coreContrib

JSON definition

{
  "id" : "Document.Create",
  "label" : "Create",
  "category" : "Document",
  "requires" : null,
  "description" : "Create a new document in the input folder. You can initialize the document properties using the 'properties' parameter. The properties are specified as <i>key=value</i> pairs separated by a new line. The key used for a property is the property xpath. To specify multi-line values, you can use a \\ character followed by a new line. <p>Example:<pre>dc:title=The Document Title<br>dc:description=foo bar</pre>. Returns the created document.",
  "url" : "Document.Create",
  "signature" : [ "document", "document", "documents", "documents" ],
  "params" : [ {
    "name" : "type",
    "description" : "",
    "type" : "string",
    "required" : true,
    "widget" : null,
    "order" : 0,
    "values" : [ ]
  }, {
    "name" : "name",
    "description" : "",
    "type" : "string",
    "required" : false,
    "widget" : null,
    "order" : 0,
    "values" : [ ]
  }, {
    "name" : "properties",
    "description" : "",
    "type" : "properties",
    "required" : false,
    "widget" : null,
    "order" : 0,
    "values" : [ ]
  } ]
}