Gå til indhold

About merge fields configuration

Dette indhold er ikke tilgængeligt i dit sprog endnu.

Merge fields help WorkZone users create templates in Microsoft Word. From a WorkZone point of view, a merge field represents a specific property of an entry. An entry is an object in OData that refers to the WorkZone database. Entries in OData are used to retrieve specific values from the database.

When creating a template, the user fills in mandatory fields on the Document tab of the WorkZone pane in Microsoft Word, clicks Merge fields, and adds the needed merge fields by selecting relevant menu items from the Insert merge field tab. Once the user clicks Merge, WorkZone will replace each inserted merge field with relevant values from the WorkZone database.

You can create sub-menus and define which menu items would be displayed in each merge fields category. Available merge fields are divided into 4 categories:

  • Document
  • Case
  • Document contact
  • Case contact

There are two files that define the merge-related functionality:

To edit an existing merge field, you only need to customize the merge_odata_description.xml file.

To add a completely new merge field, you need to customize both the merge_odata_description.xml and menu_description.xml files.

You can define the following:

  • Merge fields and their order on the Insert merge field tab of the WorkZone pane in Word.
  • Titles and placeholders of the merge fields
  • Merge functionality

This file describes data that is used for merging merge fields and values from the database. Merge of multiple entities is not supported, so make sure that you only select single items in your queries. To edit the file, you must have knowledge about OData.

  • property: Establishes mapping atom:content -> metadata:properties.

    • internal: Attribute for internal usage only. You can use it to display or hide a merge field in menu on UI. If the value is false, the merge field is displayed. If the value is true, the merge field is hidden.
  • link: Establishes mapping to atom:link. Only atom:link with type=entry is supported. The structure of linkis the same as the structure of staticData. This element is optional.

    • query: relative OData request that contains any allowed OData system query options. The only exceptions are selectand expandoptions that are built based on the property and link elements.
    • addressContext: Defines which rule must be applied to handle protected addresses locally and from Merge API. Available values are the following: CaseOfficer, CaseResponsibleUnit, RecordOfficer, RecordResponsibleUnit, RecordParty, and CaseParty.
  • dynamicData: Builds merge field menus with items based on queries.

    • key: Use together with the query attribute to create an OData query. The value of key is used as an ID of a menu item.
    • additionalKey: Use additionally to key, if OData entities have complex ID.
    • value: Use together with the query attribute to create an OData query. The value of value is used as a label of a menu item.
  • staticData: Builds merge field menus with items based on the static properties. The element reflects the OData atom payload for a specific entity. For more information, see Naming conventions and Atom format.

    • href: Mapping to atom:link.
    • query: Relative OData request that contains any allowed OData system query options.
    • group: Groups-related data for the repeating content. For example, Information or Dates in the Contact menu.
    • addressContext: Defines which rule must be applied to handle protected addresses locally and from Merge API. Available values: CaseOfficer, CaseResponsibleUnit, RecordOfficer, RecordResponsibleUnit, RecordParty, CaseParty.
  • linkTemplate: Child element of the staticData element and also reflects the OData atom payload for a specific entity. This element is only used for the 81E576F0-FFAA-4229-8B46-2BEC4972B474 (Record staticData) ID and has an additional attribute.

    • href: Mmapping to atom:link.
    • queryForLocalData: Describes OData query based on the ‘local’ Record data. The attribute refers to the run-time dependency {record.<SOM field name>}.

During the merge, all run-time dependencies will be replaced with the correspondent values. All dependencies are wrapped in ‘{}’. There are 4 types of dependencies:

  1. {recordId}: ID of the document that a user merges.
  2. {addressId}: ID of an address that belongs to a corresponding case or document party.
  3. {guid}: Reference to a dynamicData ID or property ID in merge_odata_description.xml.
  4. {record.<SOM field name>} , where ‘<SOM field name>’ is a direct document field name. This dependency was created for the scenarios when a document is not yet saved on the server.

This file describes the UI elements. Use it to make a new merge field available to your WorkZone users in Microsoft Word.

There are three main sections in the file:

  1. Menus: Customize structure of menus, supertips, and screentips.
  2. Labels: Override the default menu item names and merge field titles.
  3. Content controls: Customize the merge fields.

Elements and attributes:

  • menu: Describes the static menu. You can create menu items by adding dynamicMenu elements. If you want to create a new sub-menu, add another menu element within this element.
  • displayName: Defines the menu name displayed in Word.
  • supertip and screentip: Define the tooltips, displayed when users move the mouse over the menu.
  • dynamicMenu: Adds menu items based on the data from the merge_odata_description.xml file.
    • contentRefs: A reference to the entries in the merge_odata_description.xml.
    • repeatable: Identifies menu item that must be used to repeat the merge field. When repeat section is used around the merge field, the menu item with repeatable="true" is used.

Elements and attributes:

  • label: Overrides the default menu item label for a specific property that is defined in the merge_odata_description.xml file.
    • dataItemRef: specifies the reference to the property of an entry.
  • value: Specifies a language-specific label. It will also be used as a merge field placeholder.
    • format: Use it to format a value (optionally).

Elements and attributes:

  • NoEntityRules: Defines the merge field behavior, if a user clicks Merge, but no value exists for this merge field.
    • <Rule rule="Unchanged">: Add merge field into this element, if you want to display this merge field in the user interface, even when there is no value.
    • <Rule rule="Empty">: Add merge field into this element, if you want to hide this merge field from the user interface, when there is no value.
      • menuDataRefs: Specifies a reference to a staticData and link in the merge_odata_description.xml file.
  • cc: Defines which information to include in the merge field title.
  • dynamicMenuRef: Specifies the name of a sub-menu or a menu item for which you want to apply this title.
  • titleFormat: Specifies the merge field title.
    • {displayName}: Displays the name of the menu item that a user has clicked.
  • holderFormat: Optionally, specify the merge field placeholder.

For example, you want to create a new merge field called Entity updated overrided that will represent the Entity updated property of the MruRecords entry. To create such merge field, you need to create a reference to the database through OData and add a new menu item that will appear in Word.

  1. Open the merge_odata_description XML file. To request a specific entry, create a query to OData. Use the following example:

    <staticData id="E34FE056-129F-46D2-B7E7-A20D91F9F47C" query="MruRecords?$filter=Value eq
    '{recordId}' and User_Value eq '{record.officer}'">

    where:

    • staticData: use this element to request an entry.
    • E34FE056-129F-46D2-B7E7-A20D91F9F47C: insert a unique ID that will be used internally as a reference to the OData entry. You may use any unique ID, however, it is recommended to use a GUID generator to generate the ID.
    • query: an OData request that retrieves the entry that you need. In this example, it is a call to the MruRecords entry.
  2. Within the staticData element, bind a merge field with the required property. To do this, you need to add and define the property element. You may add as many properties as you need.

    <staticData id="E34FE056-129F-46D2-B7E7-A20D91F9F47C" query="MruRecords?$filter=Value eq
    '{recordId}' and User_Value eq '{record.officer}'">
    <property id="C5D4237E-2DEF-4D5A-B714-1F5CA88518F5" name="EntityUpdated " />
    </staticData>

    where:

    • property: use this element to request a property.
    • E34FE056-129F-46D2-B7E7-A20D91F9F47C: insert a unique ID that will be used internally as a reference to the property of the entry.
    • name: specify property’s name in OData.=
  3. Add a new menu item to the Word application. You can do this in the menu_description XML file. Open the file and find a proper place for the new menu item. The current example represents how to search for the Document category. Expand to find a proper category for your menu item:

    • <menu id="Case"> refers to Case.
    • <menu id="Record"> refers to Document.
    • <menu id="CaseParty"> refers to Case contacts.
    • <menu id="RecordParty"> refers to Document contacts. In the code source, the Document category refers to Record. Therefore, the new sub-menu must be added under the <menu id="Record"> element:
    <menu id="Mru">
    <displayName xml:lang="en-GB">Mru test</displayName>
    <displayName xml:lang="da-DK">Mru test</displayName>
    <dynamicMenu id="Mru_Items">
    <contentRefs>
    <ref>E34FE056-129F-46D2-B7E7-A20D91F9F47C</ref>
    </contentRefs>
    </dynamicMenu>
    </menu>;

    where:

    • menu: use this element to create a sub-menu.
    • displayName: define a menu name to be displayed in Word.
    • dynamicMenu: use this element to create new menu items.
    • ref : specify reference to the unique ID in the merge_odata_description XML file.
  4. Optionally, define customized labels (names) for the new menu item and merge field:

    <label dataItemRef="C5D4237E-2DEF-4D5A-B714-1F5CA88518F5">
    <value xml:lang="en-GB">Entity updated overrided</value>
    <value xml:lang="da-DK">Entity updated overrided</value>
    </label>

    where:

    • label: specifies a customized name.
    • dataItemRef: specifies a reference to the property of the entry from the merge_odata_description XML file.
    • xml:lang: is a localization parameter.
  5. You can define how the merge field must behave in Word when there is no value. There are two options:

    • Display merge field with no changes. To do so, specify the unique ID of the entry within the <Rule rule="Unchanged"> section.
      <Rule rule="Unchanged">
      <menuDataRefs>
      <ref>E34FE056-129F-46D2-B7E7-A20D91F9F47C</ref>
      </menuDataRefs>
      </Rule>
    • Hide the merge field. To do so, specify the unique ID of the entry within the <Rule rule="Empty"> section.
      <Rule rule="Empty">
      <menuDataRefs>
      <ref>17EDE3E5-43D3-4B88-8E6E-F336D916B916</ref>
      </menuDataRefs>
      </Rule>

    where:

    • ref: is a reference to the unique ID in the merge_odata_description XML file.
  6. Optionally, you can define which information should be included in the merge field title.

    <cc dynamicMenuRef="Mru_Items">
    <titleFormat xml:lang="en-GB">(Document, Mru) {displayName}</titleFormat>
    <titleFormat xml:lang="da-DK">(Document, Mru) {displayName}</titleFormat>
    </cc>

    where:

    • dynamicMenuRef: specifies a reference to a menu item.
    • TitleFormat: defines the merge field title for each language.
    • {displayName}: displays the name of the menu item that a user can click.