---
schema_version: "1"
id: 1d7f23aa9c521afc824a6af54bcee0ea69721c4f0aaaec6648fa7da09ea89717
title: field
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/dataweave/2.3/dw-values-functions-field.md
canonical_url: https://docs.mulesoft.com/dataweave/2.3/dw-values-functions-field
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 13a891f40d5fe12a107997e87975cd4dea23796eaebee49d0f52d6df196cb28e
description: MuleSoft Documentation Site
release: "2.3"
latest: false
---
---
product: DataWeave
version: 2.3
---

# field

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

## field(Namespace | Null, String): PathElement

This function creates a `PathElement` data type to use for selecting an _object field_ and populates
the type’s `selector` field with the given string.

Some versions of the `update` and `mask` functions accept a `PathElement` as an argument.

### Parameters

<table><colgroup><col> <col></colgroup><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><p><code>namespace</code></p></td><td><p>The namespace of the field to select. If not specified, a null value is set.</p></td></tr><tr><td><p><code>name</code></p></td><td><p>A string that names the attribute to select.</p></td></tr></tbody></table>

### Example

This example creates an object field selector for a specified namespace (`ns0`) and sets the
selector’s value to `"myFieldName"`. In the output, also note that the value of the `"kind"` key is
`"Object"`.

#### Source

```DataWeave
 %dw 2.0
 output application/json
 import * from dw::util::Values
 ns ns0 http://acme.com/foo
 ---
 field(ns0 , "myFieldName")
```

#### Output

```Json
{
   "kind": "Object",
   "namespace": "http://acme.com/foo",
   "selector": "myFieldName"
 }
```
