> For the complete documentation index, see [llms.txt](https://docs.keyfax.biz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.keyfax.biz/product-suite/keynamics/configuration/fetchxml/creating-fetchxml-queries.md).

# Creating FetchXML queries

This is an example of a **FetchXml query** which retrieves fields from the **contact** and **account** entities. It contains a single **bookmark** which is supplied by a mapping entry, in this case, one that pulls the `contactid` from the current form. Items are returned as a **comma separated** string:

<figure><img src="/files/3fd8g9nqLtU2L4SlvB3t" alt=""><figcaption></figcaption></figure>

### Fields

#### Name

A name which describes the purpose of this FetchXml query.

#### **FetchXML Statement**

The query itself including any bookmarks.\
\
Note that valid bookmarks are:\
\
**PARENTID** - this is useful if the form intending to launch Keyfax has a parent, e.g. Contact or Account etc. \
**BOOKMARK#1** to **BOOKMARK#3** - these will be replaced with the values specified in the (up to) 3 Bookmark values specified below.\
\
These bookmarks must appear as above in **UPPER CASE** in your Query..

#### **Separator**

If the query returns more than one value, this separator can be used to split items. These values will be concatenated into a single field/node specified by the Mapping. \
\
In the Mapping that uses this FetchXml, if **multiple target nodes** are specified each returned item is stored separately.

#### **Bookmark#1 - 3**

These fields are lookups from which you can select other mapping entries in order to satisfy the FetchXml query. in the example above, the mapping entry '**Current Form Contact id**' is used. This is a 'dummy' mapping entry; because the **Target** is **null**, this merely provides data to complete the FetchXml query and won't be sent to Keyfax (unless required):

<figure><img src="/files/OuPDM10E61FkQRgJGePN" alt=""><figcaption></figcaption></figure>

Note that the FetchXml query will only return attributes that have been *explicitly* requested in each **attribute** statement e.g. **\<attribute name="myattribute" />**. Where [composite attributes](https://docs.microsoft.com/en-us/powerapps/developer/model-driven-apps/clientapi/reference/composite-attributes) are queried, some attibutes will be ignored, unless they are contained in the query's attribute list.&#x20;
