---
url: /process-functions/security-application-elementtag.md
description: >-
  An access tag that controls which elements of a dimension its users can read
  or write.
---

# &#x20;ElementTag&#x20;

An access tag that controls which elements of a dimension its users can read or write.

```js
const app = security.application("My Application");
const tag = app.tags.createElement("Region Access", "Account", "Default");

tag.set("Revenue", "read");
tag.addUser("user@example.com");
```

## Constructor

Returned by [createElement()](/process-functions/security-application-tags#createelement) and [get()](/process-functions/security-application-tags#get) on an application's [tags](/process-functions/security-application-tags). It can't be created directly.

## Overview

* **Access levels:** `"read"`, `"write"` or `"none"`. Any other value is stored as `"none"`.
* **Users:** methods that take a user accept their id, email address or a [User](/process-functions/userSecurity-user).

## Methods

### id `id()`  {#id}

Returns the tag's id.

### name `name()`  {#name}

Returns the tag's name.

### type `type()`  {#type}

Returns `"element"`.

### access `access()`  {#access}

Returns the tag's access entries. Each key is an element name and each value is its access level.

### set `set(element, access)`  {#set}

Sets the tag's access level for an element.

| Parameter | Type | Description |
|---|---|---|
| `element` | `string` | The element's name. |
| `access` | `string` | `"read"`, `"write"` or `"none"`. |

### remove `remove(element)`  {#remove}

Removes the tag's access entry for an element. Returns `true` when it was removed.

| Parameter | Type | Description |
|---|---|---|
| `element` | `string` | The element's name. |

### clear `clear()`  {#clear}

Removes every access entry from the tag.

### users `users()`  {#users}

Returns the [User](/process-functions/userSecurity-user) objects that hold this tag.

### hasUser `hasUser(user)`  {#hasuser}

Returns `true` when a user holds this tag.

| Parameter | Type | Description |
|---|---|---|
| `user` | `number \| string \| User` | The user's id or email address, or the user. |

### addUser `addUser(user)`  {#adduser}

Gives a user this tag. Returns `true` when it was added.

| Parameter | Type | Description |
|---|---|---|
| `user` | `number \| string \| User` | The user's id or email address, or the user. |

### removeUser `removeUser(user)`  {#removeuser}

Takes this tag from a user. Returns `true` when it was removed.

| Parameter | Type | Description |
|---|---|---|
| `user` | `number \| string \| User` | The user's id or email address, or the user. |

### json `json(includeAccessEntries)`  {#json}

Returns the tag as an object, with its `id`, `name`, `type` and the dimension and hierarchy it's for.

| Parameter | Type | Description |
|---|---|---|
| `includeAccessEntries` | `boolean` | Optional. `true` to include the access entries under `access`. |

## Examples

```js
const app = security.application("My Application");
const tag = app.tags.createElement("Region Access", "Account", "Default");

tag.set("Revenue", "read");
tag.set("Expenses", "write");
tag.addUser("user@example.com");

console.log(tag.access());
console.log(tag.json(true));
```

## Related

* [ApplicationTags](/process-functions/security-application-tags): creates and finds tags.
* [ScreenTag](/process-functions/security-application-screentag): the other kind of tag.
