Nuxeo Server

How to Set a Default Date on a Field at Document Creation

Updated: October 13, 2017 Page Information Edit on GitHub

This page is scheduled for review and update. Check back soon for updated content!

A frequent requirement with documents is to set a default date on a field when showing the creation form. This how-to will teach you how to do it easily using Nuxeo Studio's event handlers and automation chains.

Before You Start

Creating the Event Handler

In Nuxeo Studio, go to Automation > Event Handlers and add a new event handler. Name it and click Next.

In the Event Handler Definition section, make sure to select the event "Empty document created". This event will be fired right before the document form creation is shown to the user.

In the Event Handler Activation section, you may add filters to define conditions for your event handler to be used. You may relate it to a certain document type for instance, especially if you need to fill a document type specific field.

Creating the Associated Automation Chain

Now that you have setup when the event handler will take place, it is important to tell what it will do. To do so, in the Event Handler Execution section click on the button Create. Note that you may also use an existing automation chain if you created it previously.

Name your chain and click on OK.

In the automation chain, use the following operations and parameters:

Operation Parameter Value
Fetch > Context document(s)    
Document > Update property Value @{CurrentDate.calendar}
  Xpath schema:field

And that's it! Note that the previous parameter will set today's date, but you may use Nuxeo Studio's expression builder to change it. Many possibilities exist in that regard.


9 days ago manonlumeau NXDOC-1346-FT review screenshot
a year ago Manon Lumeau 13
a year ago Manon Lumeau 12 | Fix images
a year ago Manon Lumeau 11 | Fix Studio menu label
2 years ago Solen Guitter 10
3 years ago Solen Guitter 9
3 years ago Manon Lumeau 8
3 years ago Manon Lumeau 7
3 years ago Manon Lumeau 6
4 years ago Solen Guitter 5
4 years ago Solen Guitter 4 | Added excerpt
4 years ago Solen Guitter 3
4 years ago Bertrand Chauvin 2
4 years ago Bertrand Chauvin 1
History: Created by Bertrand Chauvin