JSF UI Framework

How to Customize the Bulk Import Form

Updated: July 17, 2023

The bulk import screen offers a form that allows to edit several documents at the same time. You can customize it with Studio by creating a form layout named bulkImport. The "Create" layout will be used on the bulk import popup.

Note that the Where and Files fields are obviously not customizable and will always be displayed on this form. The layout is actually below these two fields.

Creating a Form Layout in Studio

  1. In Studio, go to Listings & Views > Form Layouts and click on New,
  2. Fill in the Feature ID: bulkImport and click on Next,

    Make sure that your form layout is named bulkImport to override the default one.

  3. Go to the Creation Layout tab,
  4. Drag and drop the widgets you need,
  5. Click on Save.

Deploying Changes on Your Nuxeo Platform Instance

  1. Go to your Nuxeo Platform instance.
  2. Connect as Administrator with Administrator password.
  3. Click on Admin Center > Update Center > Nuxeo Studio.
  4. Click on the Update button.
  5. Go in a workspace and edit your documents.

Specific Cases

When you want to create a bulk edit form with the possibility to edit the collections and the tags, you need a particular configuration.

Tags

When you configure a widget to select tags, the field that needs to be referenced is contextData['request/bulk_tags']

  1. Drag and drop a generic widget from the right to the grid,
  2. Fill in the creation form, 
  3. In the Edit Properties, select Yes for the Can Select New Tag field,
  4. Click on Save and deploy your changes on your instance.

Collections

When configuring a widget to select collections, the field that needs to be referenced is contextData['request/bulk_collections'].

  1. Drag and drop a generic widget from the right to the grid,
  2. Fill in the creation form, 
  3. Fill in the Edit Properties:

    Document page provider name

    default_document_suggestion
    Selection FormatterformatSelectedCollection
    Suggestion FormatterformatSuggestedCollection

  4. In the Custom properties part fill in the following fields:

    restoreSeamCtxfalse
    operationIdCollection.Suggestion
  5. Click on Save and deploy your changes on your instance.

You should end up with something like this:

Adding New Import Options

The bulk import popup can display more than one import layout. When more than one is contributed, you can select which one you want to use to import the uploaded documents through the "Import Options" field. 

An import option is contributed through an action in the IMPORT_DOCUMENTS category.  The action must reference the chainId and the layout to use for this import option.  The action label is used in the "Import Options" select. 

The contribution of the default bulk import is:

<extension target="org.nuxeo.ecm.platform.actions.ActionService"
  point="actions">

  <action id="dndBulkImportDocuments" link=""
    order="10" label="label.smart.import"
    help="desc.smart.import.file">
    <category>IMPORT_DOCUMENTS</category>
    <properties>
      <property name="chainId">FileManager.ImportWithMetaDataInSeam</property>
      <property name="layout">bulkImport@create</property>
    </properties>
  </action>
</extension>

The layout displayed will be bulkImport@create and documents will be imported through the FileManager.ImportWithMetaDataInSeam chain. 

To add a new one, you can just add a new action referencing your own layout (or the default one) and your own chain id (or the default one).

In this example we create an import option that puts the status of your document “obsolete” if you type in the term "legacy" in the source metadata.

  1. In Studio, create this automation chain,

    - FileManager.Import:
        overwite: "true"
    - Document.Update:
        properties: {}
        save: "true"
    - Document.SetLifeCycle:
        value: "@{Document[\"dc:source\"] == \"legacy\" ? \"obsolete\" : \"approve\"}"
    - Seam.Refresh
    
  2. You can now create an xml extension to add an import option that call our chain,

    <extension target="org.nuxeo.ecm.platform.actions.ActionService"
      point="actions">
    
      <action id="customBulkImportDocuments"
        order="20" label="My Custom Import">
        <category>IMPORT_DOCUMENTS</category>
        <properties>
          <property name="chainId">ImportChain</property>
          <property name="layout">ImportLayout@create</property>
        </properties>
      </action>
    </extension>
    
  3. Click on Save. You can now deploy your changes on your platform. 

Disabling the Default Import Option

If you want to disable the default import option (after having contributed a new one for instance), you can do it with the following contribution:

<extension target="org.nuxeo.ecm.platform.actions.ActionService"
  point="actions">

  <action id="dndBulkImportDocuments" enabled="false" />
</extension>

After deploying your changes, you can only see your custom import option when you click on Import