> For the complete documentation index, see [llms.txt](https://cortex-docs.paloaltonetworks.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cortex-docs.paloaltonetworks.com/python-development-quick-start-guide/cortex-xsoar-python-development-quick-start-guide/development-tools-and-resources/cortex-xsoar-automation-scripts/multi-select-field-display.md).

# Multi-select Field Display

You can create a script for a display field with custom multi-select options.

This example automation creates a field called **multiselectfield** that has a type **Multi select** . You then define in the Cortex XSOAR console the list of options that can be selected.

1. Use the basic automation template to create the following code.

   The field displayed is passed in the **`field`** argument and **`selectValues`** contains the list of options that can be selected.

   The Python function **`sorted()`** is used to sort the values and update the field options.

   ```programlisting
   def main():
       try:
           vals = demisto.args()['field']['selectValues']
           return_results({'hidden': False, 'options': sorted(vals)})
       except Exception as ex:
           demisto.error(traceback.format_exc())
           return_error("Failed to sort display field values +
               str(ex)
           )

   if __name__ in ("__main__", "__builtin__", "builtins"):
       main()
   ```
2. Use the **Settings** button to add the **`field-display`** tag.

   This makes the automation available as a field display automation.
3. Create a new incident field **multiselectfield** that has a field type **Multi select** and enter the list of values that can be selected.

   ![cortex-xsoar-automation-multi-select.png](/files/sWAZbpyYZjY9yJegk6AA)
4. In the **Attributes** tab, select the **Field display script** and select the automation just created.

   ![cortex-xsoar-automation-select-field-display-script.png](/files/fesJfvMYNCqYFMxlDfEs)
5. In the incident layout created previously (see [Add a Table to the Incident Layout](/python-development-quick-start-guide/cortex-xsoar-python-development-quick-start-guide/development-tools-and-resources/cortex-xsoar-automation-scripts/add-a-table-to-the-incident-layout.md)), add another section and add the **multiselectfield** field just created.
6. In an incident, click the **multiselectfield** and observe the sorted list of options.

   ![cortex-xsoar-automation-drop-down.png](/files/a83Xac09MnBadiefCDZ3)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://cortex-docs.paloaltonetworks.com/python-development-quick-start-guide/cortex-xsoar-python-development-quick-start-guide/development-tools-and-resources/cortex-xsoar-automation-scripts/multi-select-field-display.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
