Open topic with navigation

# `item` element

The `item` element is used to retrieve an item from the Dynamics CRM repository, and insert the value of this item into the document metadata.

Attribute | Description | Required
--- | --- | ---
`name` | The name of the item to retrieve. | Yes
`position_in_document` | The location in the document where you want to insert value of the item: `nested_field` (default). The connector adds the value of the item to a metadata field that is nested according to the structure of your retrieval specification. `root_field`. The connector adds the value of the item to a metadata field at the root of the document. `content`. The connector appends the value of the item to the document's `DRECONTENT` field. | No
`field_name` | The name of the document field to create to contain the item value. By default, the document field takes the name of the item. | No

## Example

The following example creates a document for each account in the repository. These documents have fields named `accountid`, `name`, and `description` which contain information about the account. The document also has a field named `owninguser`, and this field has sub-fields named `employeeid` and `fullname`.

    <?xml version="1.0" encoding="utf-8"?>
    <spec>
      <collection name="accounts">
        <item name="accountid" />
        <item name="name" />
        <item name="description" />
        <object name="owninguser">
          <item name="employeeid" />
          <item name="fullname" />
        </object>
      </collection>
    </spec>

An example of a document produced by this specification appears below:

    <DOCUMENT>
      <DREREFERENCE>http://host/Dynamics/api/data/v8.1/accounts(34b8ffd0-4232-e611-80c5-0050569248a7)</DREREFERENCE>
      <accountid>34b8ffd0-4232-e611-80c5-0050569248a7</accountid>
      <description>This is the description</description>
      <name>Hewlett Packard Enterprise</name>
      <owninguser>
        <employeeid>0123456</employeeid>
        <fullname>John Smith</fullname>
      </owninguser>
    </DOCUMENT>

If you wanted to use the field name `accountname` for the account name, instead of `name`, you could use the `field_name` attribute as follows:

    <?xml version="1.0" encoding="utf-8"?>
    <spec>
      <collection name="accounts">
        <item name="accountid" />
        <item name="name" field_name="accountname" />
        <item name="description" />
        <object name="owninguser">
          <item name="employeeid" />
          <item name="fullname" />
        </object>
      </collection>
    </spec>

An example of a document produced by this specification appears below:

    <DOCUMENT>
      <DREREFERENCE>http://host/Dynamics/api/data/v8.1/accounts(34b8ffd0-4232-e611-80c5-0050569248a7)</DREREFERENCE>
      <accountid>34b8ffd0-4232-e611-80c5-0050569248a7</accountid>
      <accountname>Hewlett Packard Enterprise</accountname>
      <description>This is the description</description>
      <owninguser>
        <employeeid>0123456</employeeid>
        <fullname>John Smith</fullname>
      </owninguser>
    </DOCUMENT>

To insert the metadata about the `owninguser` object at the root level of the document, and not as sub-fields, you could use the `position_in_document` attribute, for example:

    <?xml version="1.0" encoding="utf-8"?>
    <spec>
      <collection name="accounts">
        <item name="accountid" />
        <item name="name" field_name="accountname" />
        <item name="description" />
        <object name="owninguser">
          <item name="employeeid" position_in_document="root" />
          <item name="fullname" position_in_document="root" />
        </object>
      </collection>
    </spec>

An example of a document produced by this specification appears below:

    <DOCUMENT>
      <DREREFERENCE>http://host/Dynamics/api/data/v8.1/accounts(34b8ffd0-4232-e611-80c5-0050569248a7)</DREREFERENCE>
      <accountid>34b8ffd0-4232-e611-80c5-0050569248a7</accountid>
      <accountname>Hewlett Packard Enterprise</accountname>
      <description>This is the description</description>
      <employeeid>0123456</employeeid>
      <fullname>John Smith</fullname>
    </DOCUMENT>

© Copyright 2019 Micro Focus or one of its affiliates | Send documentation feedback Close Send documentation feedback To open the configured email client on this computer, open an email window. Otherwise, copy the information below to a web mail client, and send this email to swpdl.idoldocsfeedback@microfocus.com. We appreciate your feedback! Product: Topic Title: Help Topic: Feedback:

_FT_HTML5_bannerTitle.htm