# Mapping Choice Fields

For option set or choice field types the displayed text value is used to identity the entry within the list. Consider the following choice field as defined on your entity table within Dynamics 365...

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

To ensure "Item 1" is selected when Keyfax compeltes you would need to return the text "Item 1" within the Keyfax results and map this to the relavent choice field on the entity form. To return this value from your Keyfax script you could use a fixed text databox as shown below\...

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

You can then write a value from this fixed text databox to the desired export XML element via a databox write within a Keyfax script as sown below\...

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

The KeyNamics "RECEIVE" mapping to actually map the returned Keyfax value to the choice field on the entity form would look like so (note in this example `keyfax_receive_optionset` is the logical name for the field however this will differ for your mapping)...

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

With the mapping in place if the `Nominal_Code` element returns "Item 1" then the targeted choice form field will be updated to "Item 1" upon Keyfax completion as shown below\...

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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.keyfax.biz/product-suite/keynamics/configuration/mappings/mapping-choice-fields.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
