Articles in this section

How to set Custom XML Value, Managed Metadata and DateTime Value

This article explains what Custom XML Value, Managed Metadata and DateTime Value is and provides examples of how it can be used with the binding syntax in smart templates.

  Prerequisites

  • Library and at least one Dynamics module enabled.
  • Templafy Desktop and Office VSTO add-in installed.
  • Admin/owner access to the Templafy tenant and Space owner access.

What are Custom XML Value, Managed Metadata and DateTime Value properties? 

Custom XML Value, Managed Metadata and DateTime Value contain metadata.

Metadata is information about a document that is not part of the main content. It helps describe its content and characteristics. In e.g. a Word document, metadata can include details like the title, author, creation date and last modified date. This information helps to organize, search for, and manage documents more effectively in Document Management Systems (DMS) such as SharePoint.

You can use the following options in Template Designer to save the required metadata:

  • Custom XML Value: Always use this option (e.g. for textbox form fields), unless the column in SharePoint is of type 'Managed Metadata' (term sets) or 'Date and Time'.
  • Custom XML Managed Metadata: Use this option only when the column in SharePoint is of type 'Managed Metadata' (term sets).
  • Custom XML DateTime Value: Use this option only when the column in SharePoint is of type 'Date and Time'.

  Important

  • Document properties are only supported with templates that are stored in the Libraries (Documents, Presentations, and Spreadsheets Libraries).
  • Assets (Text elements, Email elements, Slides, and Slide elements Libraries) inherit properties from the document, presentation or spreadsheet upon insertion.
    • In case of Text elements, a custom document property only works when the text element is opened directly from the Web App (as if it were a document).
  • Adding SharePoint metadata generated document properties using Quick parts -> Document Property is not supported (values are removed on 'Update document'). Injecting custom XML properties is only supported using the XML Mapping Pane.

How to set Custom XML Value, Managed Metadata and DateTime Value in a smart template

When configuring the template settings and properties, Custom XML Value, Managed Metadata and DateTime Value can be used to set the metadata for the template, following the steps below:

  1. In Template Designer open the Advanced tab.
  2. Click + Add property.
  3. In the Type field select Custom XML Value, Managed Metadata or DateTime Value:
    • Custom XML Value: set the Binding, Namespace and Path.
    • Custom XML Managed Metadata: set the Namespace, Path, Term ID and Term Name.
    • Custom XML DateTime Value: set the Binding, Namespace and Path.
  4. Optional: enable Disable Updates. Disallow the values from being updated when the user updates the document using the document content updater.
  5. Click Add to document.

How to configure Custom XML Value

In the example below a Word template is configured and the metadata is saved to SharePoint.

  1. Create a document in SharePoint (or upload a document):customxmlvalue_newdocument.png
  2. Close the document.
  3. Select the saved document and open the details pane. Then add random values to all columns you want to use. Do not leave them blank:
    customxmlvalue_sharepointproperties.png

      Important

    If you leave a field blank (like 'Category' in the image above), then SharePoint will attach a '@nil' value to it. As a result Templafy can't attach the Custom XML Value to the field and no metadata is saved to SharePoint.

  4. Download the document and open it in Word.
  5. Open Template Designer and click + Create template.
  6. Next, create Text questions: 'Title', 'Order ID', 'Description' and 'Category':
    formtabwithquestions.png

      Important

    • In this example Text questions are used, but other field types like Date and Dropdown are also supported.
    • If the field in SharePoint (the column you want to write metadata to) is a 'Choice' field (dropdown or radio buttons), then make sure the dropdown list items in Templafy are written exactly the same way as in SharePoint (the list items are case sensitive).
  7. On the Advanced tab click + Add property, then in the Type field select Custom XML Value:
    advancedtabcustomxmlvalue.png
  8. On the Developer tab select XML Mapping Pane. In the field Custom XML Part select http://schemas.microsoft.com/office/2006/metadata/properties. When you select this namespace, an element named properties with a child element named documentManagement appears. Expand documentManagement to show all available fields (column names) from SharePoint:
    customxmlvaluexmlmappingpane.png

      Important

    The name of an element should not be expandable. If it is expandable then it will show the '@nil' value mentioned before.

    Note that the column Order ID from SharePoint is shown as Custom XML Part Order_x0020_ ID. The name Order ID is the display name in SharePoint, while Order_x0020_ IDis the internal name (this is the name you need to use for your template). In SharePoint the internal name can be retrieved by opening the properties of a column. The URL will show the internal name:
    customxmlvalue_internalname.png
  9. The form contains these fields:
    customxmlvaluemapping.png
    • Binding: enter the form field you want to use, in this case '{{Form.OrderID}}'.
    • Namespace: enter http://schemas.microsoft.com/office/2006/metadata/properties.
    • Path: enter /p:properties/documentManagement/*[local-name()="<field>"], where <field> is the name of the field that needs to be used. In this example the result is /p:properties/documentManagement/*[local-name()="Order_x0020_ID"].

        Important

      • Values in the fields above are case-sensitive.
      • Use *[local-name()="<field>"] on every level, or only where a namespace is specified (explanation about namespaces is beyond this help topic). If this notation doesn't give the expected result then only use the field name instead, in this example that would be: /p:properties/documentManagement/Order_x0020_ID.
      • In the Binding field, instead of a form field, plain text can also be used to set the metadata. For example if you always want to write the same value to SharePoint. Enter the text without curly brackets or quotes.
      • In the Binding field, you can also use a HostSystem binding, for example if you get data from Salesforce, that you want to write to SharePoint.
  10. Click Add to document.
  11. Also create document properties for the 'Description' and 'Category' fields. The result looks like this:
    customxmlvaluebindings.png
    We also want to save the Title of the document to SharePoint. This is a special field (note that it is not available as Custom XML Part in the image from step 8). Instead of using Custom XML Value, you have to select Document Property.
  12. On the Advanced tab click + Add property and select Document Property:
    documentpropertytitle.png
    • Property Name: select the document property field you want to use, in this case Title.
    • Property Value: enter the form field you want to use, in this case '{{Form.Title}}'.
  13. Click Add to document.
  14. Save the template (name it e.g. 'MyTemplate') and upload it to the Admin Center.
  15. Open the template in Composer as an end-user, fill in the questions and create a document:
    customxmlvaluecomposer.png
  16. Save the document to SharePoint. The metadata is shown in the columns and the details pane. The result looks like this:
    customxmlvalue_sharepointresult.png

      Important

    Note that no metadata is written to the Category column. This is because SharePoint attached a '@nil' value, because we left the field blank in step 3!
    That is why it is important to fill all columns.

How to configure Managed Metadata (term sets)

A special column of type Managed Metadata can be created in SharePoint. It enables users to select terms from a specific term set. If you want to use this column in your template, follow the steps below.

In this example the template from the previous example (How to configure Custom XML Value) is expanded with custom XML that saves the value to a managed metadata column in SharePoint.

  Important

For managed metadata you need to use Custom XML Managed Metadata on the Advanced tab in Template Designer.

  1. In SharePoint create a new column (in this example Snacks) and select Managed Metadata as the type of information:
    customxmlvaluemanagedmetadata.png

     

      Important

    The option Allow multiple values is not supported in Templafy.

  2. In the section Term Set Settings you can use a managed term set or create your own term set. In this example Customize your term set is selected. Click Create Term to create one or more terms:
    customxmlvalue_customizetermset.png
  3. The result looks like this:
    customxmlvalue_termset.png
  4. For Templafy you need to know the Unique Identifier for each term created in the previous step. Go to the Site Settings page and open Term store management:
    customxmlvaluesitesettings.png
  5. In the Term Store Management Tool, when you select a term, the details show the Unique Identifier:customxmlvalue_uniqueidentifier.png

     

      Tip

    You can also find the terms and unique identifiers in Windows Explorer (after you have saved a document (created from Word) to SharePoint in the library that contains a managed metadata column).
    Go to 'C:\Users\<username>\AppData\Local\Microsoft\Office\TermSets'. This folder contains files like 'abc1d2ed-3456-7898-7cba654321.xml'. Find the correct file (in general a file created today) and open it in Notepad.

  6. In the Admin Center create a data source that contains all terms and their corresponding unique identifiers. You can use the default Name column and e.g. a column named UniqueIdentifier:
    datasourceuniqueidentifier.png
  7. Next, from the Admin Center download the template ('MyTemplate') created in the previous example (How to configure Custom XML Value), and open it in Template Designer. Create a dropdown form field (e.g. 'Snack') and link it to the Name column of the data source from the previous step:
    customxmlvaluedropdown.png
  8. Save the template.

      Important

    The new column created in SharePoint needs to be added as Custom XML part to the template. To do this, you need to upload the template to SharePoint, to the library where you have created the new column.

  9. Upload the template to SharePoint (to the library where you have created the new column).
  10. In SharePoint select the saved template and open the details pane. Then add a random value to the new field 'Snacks' (and to all other columns you want to use):
    customxmlvalue_sharepointmetadata.png
  11. Download the template and open it.
  12. On the Developer tab select XML Mapping Pane. In the field Custom XML Part select http://schemas.microsoft.com/office/2006/metadata/properties. You see all available fields (column names) from SharePoint created earlier, and a new field named (in this example) 'k48e728b471d4ab68c80ce6895fa8dd5' with child elements named 'Terms', 'TermInfo', 'TermName' and 'TermId'.
    In the XML Mapping pane managed metadata fields are not shown with their display name, but with their unique identifier. The identifier shown in this example represents the field (column) Snacks you have created:
    customxmlvalue_xmlmapping.png

      Important

    If you are not sure the identifier represents the field (column) you want to use, then you can follow these steps: rename the extension of the downloaded template (document) to .zip. In the zip file go to the 'CustomXML' folder. This folder contains one or more XML files named 'itemX.xml'. Open the one that looks similar to the example below. Here you'll find the same identifier which, in this case, contains a child element 'TermName' that contains the value 'Hamburger'. This value indicates the identifier represents the field (column) Snacks:

    customxmlvaluexmlfile.png

  13. On the Developer tab select XML Mapping Pane. In the field Custom XML Part select http://schemas.microsoft.com/office/2006/metadata/properties:

    customxmlvaluetermsmapping.png
  14. Create a Custom XML Managed Metadata field with these values (see image above):
    • Namespace: enter http://schemas.microsoft.com/office/2006/metadata/properties.
    • Path: enter /p:properties/documentManagement/*[local-name()="<field>"], where <field> is the name of the field you want to use. In this example the result is: /p:properties/documentManagement/*[local-name()="k48e728b471d4ab68c80ce6895fa8dd5".
    • Term ID: enter the form field you want to use for the Term ID, in this case {{Form.Snack.UniqueIdentifier}}.
    • Term Name: enter the form field you want to use for the Term Name, in this case {{Form.Snack.Name}}.

        Important

      • Values in the fields above are case-sensitive.
      • In the Path you need to use the unique identifier (like "k48e728b..."), not the display name.
      • In the Path use *[local-name()="<field>"]. If this notation doesn't give the expected result then only use the field name instead, in this example that would be: /p:properties/documentManagement/k48e728b471d4ab68c80ce6895fa8dd5.
  15. Save your template and upload it to the Admin Center.
  16. Open the template in Composer as an end-user, fill in the questions and create a document:
    customxmlvaluecomposerdropdown.png
  17. Save the document to SharePoint. The (managed) metadata is shown in the columns and the details pane. The result looks like this:
    customxmlvalue_sharepointresults.png

How to configure DateTime Value

A column of type Date and Time can be created in SharePoint. It enables users to select a date from a calendar. If you want to use this column in your template then you need to follow the steps below.

In this example the template from the previous example (How to configure Managed Metadata (term sets)) is expanded with and additional custom XML that saves the value to a date and time column in SharePoint.

  Important

For date fields you need to use Custom XML DateTime Value on the Advanced tab in Template Designer.

  1. In SharePoint create a new column (in this example Date) and select Date and Time as the type of information:
    customxmlvalue_datetime.png
  2. From the Admin Center download the template created in the previous example (How to configure Managed Metadata (term sets)), and open it in Template Designer. On the Form tab create a new date question (e.g. 'Date'):
    customxmlvaluedate.png
  3. Save the template.

      Important

    The new column created in SharePoint needs to be added as Custom XML part to the template. To do this, you need to upload the template to SharePoint, to the library where you have created the new column.

  4. Upload the template to SharePoint (to the library where you have created the new column).
  5. In SharePoint select the saved template and open the details pane. Then add a random value to the new field 'Date' (select any date from the calendar).
  6. Download the template and open it.
  7. On the Developer tab select XML Mapping Pane. In the field Custom XML Part select http://schemas.microsoft.com/office/2006/metadata/properties. You see all available fields (column names) from SharePoint created earlier, and a new field named (in this example) 'Date':
    customxmlvaluedatemapping.png
  8. Create a Custom XML DateTime Value field with these values (see image above):
    • Binding: enter the form field you want to use, in this case {{Form.Date}}.
    • Namespace: enter http://schemas.microsoft.com/office/2006/metadata/properties.
    • Path: enter /p:properties/documentManagement/*[local-name()="<field>"], where <field> is the name of the field you want to use. In this example the result is: /p:properties/documentManagement/*[local-name()="Date".

        Important

      • Values in the fields above are case-sensitive.
      • In the Path use *[local-name()="<field>"]. If this notation doesn't give the expected result then only use the field name instead, in this example that would be: /p:properties/documentManagement/Date.
  9. Save your template and upload it to the Templafy Admin Center.
  10. Open the template in Composer and create a document (select a date).
  11. Save the document to SharePoint. The date is shown in the column and the details pane. The result looks like this:
    customxmlvalue_sharepointresult__1_.png

Dynamics metadata in PowerPoint

Although PowerPoint does not have an XML Mapping Pane, you can still configure Dynamics metadata with Templafy (this basically works the same way as in Word).

To find the namespace and fields (elements) of the XML you can follow the steps below (example with SharePoint):

  1. Create a PowerPoint template (you don't have to create form fields etc.).
  2. Upload the template to SharePoint.
  3. Download the template from SharePoint.
  4. Rename the extension .pptx to .zip.
  5. Unpack the zip file.
  6. In the unpacked folder open the 'customXml' folder:
    unpackedzipfolder.png
  7. This folder contains one or more 'itemX.xml' files:
    customxmlfoldercontent.png
  8. Open each file until you find one that has content that looks like this:
    customxmlvaluenamespace.pngThe file contains the namespace (marked red) and columns available in the SharePoint library (marked green).
limitations metadata language images links image header managed metadata hide form field multi-level filtering landscape a malformed uri was found in the document inline bindings tech_role
Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Article is closed for comments.