Dashboard Document Wizard Plugin Value Injection
Inject values from the wizard dialog into the new document
New documents in the CMS are created using queries. They can be found in the Console at:
Usually the 'new-document' query is used to create a new document. And that is the default when using this document wizard too. Setting the query property overrides this default. (See the configuration page for instructions.)
Whatever value is used on the wizard dialog to create the folder(s) the new document is created in, you can use that value as a default value inside the document being created. To inject that value into the document, you have to adjust the query.
Use a variable in the creation query
If you take a look at some defined queries for creating new documents, you will see that there is a multivalued String property called hippostd:modify. Here you can define which fields to modify when the document is created.
The field and the replacement for it must be in two subsequent values of this property. The first must contain the name of the field, and the second the name of the variable that contains the value. The name of the field must be preceded with './'. So if the name of your field is myproject:publicationdate, the first value must be./myproject:publicationdate. The second value must name the variable that contains the value you want to inject.
For the two classificationTypes of this plugin, these variables can be used.
Step 1: use a custom query
The shortcut definition (e.g. /hippo:configuration/hippo:frontend/cms/cms-dashshortcuts/new-news-document) defines a query property to override the default query.
Step 2: use fieldname and variable in the query
In the query, two values need to be added to the hippostd:modify property. In this case, the date of the document will be injected with the value chosen for the date field on the dialog wizard, using the $date variable.
Step 3: when creating the document, the value in the wizard is injected into the document
- Click the dashboard shortcut to open the wizard dialog.
- Give a name and a date
- The date entered is injected into the new document.