SharePoint Metadata Fields
In addition to system columns such as Modify and Modify By, SharePoint document libraries enable configuring additional columns, which are usually used for document metadata, e.g. Document ID and Account Number. These metadata fields can then be used for document search on SharePoint, which also enables advanced scenarios including workflows, archiving and integrations.
Starting with Docentric 3.4.0, reports can be saved to SharePoint document libraries with columns which get populated with report metadata. This functionality is called Saving to SharePoint with metadata fields.
Saving with metadata is triggered via saving to SharePoint, Attachments and Print archive print options, if the target document library is configured so in Docentric report setup > SharePoint settings for the executing report. To map SharePoint document library columns with report metadata, common and report specific placeholders are used.
Enable saving to SharePoint with metadata
To enable saving metadata along with the generated documents to a SharePoint document library for a report, first we need to configure it.
In Docentric report setup, select the report for which you want to configure SharePoint metadata fields and click the Settings > Print destinations > SharePoint settings menu item. The SharePoint settings form is open.
The setup is done per report and per document library.
For a report and document library you can configure:
- When to save generated documents to SharePoint with metadata and what is the action if an error occurs.
- Mappings between the document library’s columns and report data. Document library columns are defined on SharePoint and for report data we use placeholders: Standard, Custom or User-defined.
Reports are saved to SharePoint in D365FO via:
- Docentric File print destination with the Save to SharePoint option turned on.
- Docentric File print destination with the Save to Attachments option turned on and the selected Document type which points to a SharePoint document library.
- Print archive, when archiving is done via Document type which points to a SharePoint document library.
Learn how to set up document types used for archiving >>
For each of these options there is a flag Is enabled in Docentric report setup > SharePoint settings which, if turned on, enables saving to SharePoint with metadata fields defined in the SharePoint metadata fields grid on the same form.
Configure SharePoint Document library
When you add a new SharePoint setting, you first need to specify SharePoint site and Document library – you can type them in or select them using the SharePoint picker control.
Next, you can enable metadata saving for:
- Docentric File print destination > Save to Sharepoint
Enable uploading generated files with the configured metadata fields when printing reports to SharePoint directly, using Docentric File print destination with the Save to SharePoint option turned on and the configuring SharePoint document library selected as the target SharePoint location.
- Docentric File print destination > Save to Attachments
Enable uploading generated files with the configured metadata fields when printing reports to SharePoint indirectly, using Docentric File print destination with the Save to Attachments option turned on and the selected Document type that points to the configuring SharePoint document library.
- Docentric Archive print destination or any print destination > Save to Print Archive
Enable uploading generated files with the configured metadata fields when printing reports to Print archive, using the Document type that points to the configuring SharePoint document library.
You can also set up Action on error. An error can occurred if someone removes a metadata field in the configuring SharePoint document library or makes it a required field. An error can also occur if the type of a resolved placeholder value doesn’t match the data type of the SharePoint metadata column that the placeholder is bound to.
For Action on error, you can choose between Upload file without metadata fields and Do not upload file.
Configure SharePoint metadata fields
You can select a subset of all available document library’s columns to bind them to particular report data. As said, for report data common or report specific placeholders can be used. The only condition is that a document library column is bound to a placeholder of the same data type.
Select the metadata fields that are available for the current document library by following these steps:
- Click the Select button to open the Select SharePoint metadata fields drop-down dialog box.
- Select the metadata fields you want to bind to report data in the Available
- Click the Add button to move the selected metadata fields from the Available list to the Selected
- Click the Confirm selected button to save the metadata fields in the Selected list and close the dialog box.
Some document library columns might be configured as required. These fields get automatically selected when you open the Select drop-down form or when you click the Clean up and update button.
- Specify the value for each selected metadata field by selecting a corresponding placeholder. You can choose any Standard, Custom or User-defined placeholder which is of the same data type.
Use the Validate button to validate SharePoint settings. In case of a validation error, a detailed error message is displayed in the Validation result tab. Validation is also performed when a SharePoint setting is updated.
Use the Clean up and update button to automatically resolve validation errors related to the selected SharePoint metadata fields. This job deletes any non-existing metadata fields and updates the field properties.
Supported SharePoint document library columns
Supported SharePoint document library columns, i.e. metadata field data types:
- Single line of text: Plain text. Maximum number of characters (up to 255) is configured on SharePoint.
- Multiple lines of text: Plain or rich multiline text.
- Choice: Text representing one or multiple choices configured on SharePoint. Whether multiple selections are allowed is configured on SharePoint. Use a new line, ';' or '|' to specify multiple choices.
- Number: An integer or decimal number. Minimum and maximum allowed value as well as number of decimals are configured on SharePoint.
- Currency: An amount with a currency symbol, e.g. $123,456.00. Minimum and maximum allowed value as well as number of decimals are configured on SharePoint.
- Date and Time: Date only or Date and time.
- Yes/No: 'true' or 'false' or a number; 0 results in 'No', whereas any other number in 'Yes'.
- Person or Group: A person can be specified by username, email or ID. A group can be specified by group name or ID. Whether multiple selections are allowed is configured on SharePoint. Use ';' or '|' to specify multiple persons or groups.
- Hyperlink or Picture: A valid URL. Whether URLs will be shown as hyperlinks or pictures is configured on SharePoint. URL can be followed by Description. Use a new line, ';' or '|' to separate Description from URL.
For numbers and dates/times the following rules apply:
- User-defined placeholders: Report runtime language and Format string from the setup determine whether User-defined placeholder values, which are always strings, will be parsed as valid numbers and dates/times.
- Custom and Standard placeholders: When placeholder values are provided as numbers and dates/times (and not as strings), they will be parsed as valid numbers and dates/times. If an issue with your own Custom placeholders arises, please ensure that you are not using strings for placeholders of type number or date/time. A tip: check how Custom placeholders in Docentric DSP classes are handled.
- User-defined placeholders: Use $new-line XPath function.
- Custom and Standard placeholders: Use '\r\n' or System.Environment::NewLine.
Executing a configured report
Let’s assume that we configured SharePoint settings for the Sales invoice report and SharePoint document library Invoices on the Main site as shown above, with the Save to SharePoint > Is enabled option turned on and SharePoint metadata fields: Invoice ID, Customer Account ID, Customer Account, Invoice Date, Due Date, Total Amount.
If we configure Print management settings to save the Sales invoice reports to the same SharePoint document library Invoices, and print a Sales invoice using Print management, the result will be a document saved to SharePoint document library Invoices with all configured columns populated with the corresponding report metadata: Invoice ID, Customer Account ID, Customer Account, Invoice Date, Due Date, Total Amount.