> ## Documentation Index
> Fetch the complete documentation index at: https://docs.superoffice.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Category

> For accessing and changing a ticket category.

For accessing and changing a ticket category.

## Constructors

### Category()

```crmscript theme={null}
Category
```

Initializes a new instance of the Category class.

## Methods

## getValue(String)

Retrieves the value of the given field in the category.

```crmscript theme={null}
String getValue(String field)
```

**Returns:** [CRMScript.Global.String](CRMScript.Global.String) - The value of the specified field.

<Note>
  Available fields: id: The ID of the category; parent: The ID of the parent category; name: The name of the category; fullname: The full name of the category (such as "Support/Product A/bugs"); externalName: The external name of the category; categoryMaster: The ID of the category master; children: A comma-separated list of children IDs; notificationEmail: The value of the email Notification field
</Note>

**Example:**

```crmscript theme={null}
Category c;
c.load(2);
print(c.getValue("notificationEmail"))
```

## load(Integer)

Load object with values from category with given ID.

```crmscript theme={null}
Bool load(Integer id)
```

**Returns:** [CRMScript.Global.Bool](CRMScript.Global.Bool) - True if the category exists; otherwise, false.

**Example:**

```crmscript theme={null}
Category c;
c.load(2);
print(c.getValue("name"));
```

## save()

Saves the category and returns its ID.

```crmscript theme={null}
Integer save()
```

**Returns:** [CRMScript.Global.Integer](CRMScript.Global.Integer) - The ID of the saved category.

## setValue(String,String)

Sets the value of the given field for the category.

```crmscript theme={null}
Void SetValue(String name, String value)
```

**Returns:** [CRMScript.Global.Void](CRMScript.Global.Void)

<Note>
  Available fields: parent: The ID of the parent category; name: The name of the category; externalName: The external name of the category; categoryMaster: The ID of the category master; children: A comma-separated list of children IDs; notificationEmail: The value of the email Notification field
</Note>

**Example:**

```crmscript theme={null}
Category c;
c.load(2);
c.setValue("name", "Test");
```


## Related topics

- [category](/en/api/mdo-providers/reference/category.md)
- [Company category and category group](/en/lead/admin/add-company-category.md)
- [Request categories](/en/request/admin/category/index.md)
- [Category table](/en/database/tables/category.md)
- [NSCategory](/en/automation/crmscript/reference/CRMScript.NetServer.NSCategory.md)
- [Delete Category](/en/api/reference/restful/rest/list_category/delete-category.md)
