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

# field

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

## field(namespace: Namespace | Null = null, name: 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.

_Introduced in DataWeave version 2.2.2._

### 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"
 }
```
