> ## 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.

# NSRoleEntity

## Constructors

### NSRoleEntity()

```crmscript theme={null}
NSRoleEntity
```

Initializes a new instance of the NSRoleEntity class.

## Methods

## GetCreated()

```crmscript theme={null}
DateTime GetCreated()
```

**Returns:** [CRMScript.Global.DateTime](CRMScript.Global.DateTime) - Registered when.

**Example:**

```crmscript theme={null}
NSRoleEntity thing;
DateTime created = thing.GetCreated();
```

## GetCreatedBy()

```crmscript theme={null}
NSAssociate GetCreatedBy()
```

**Returns:** [CRMScript.NetServer.NSAssociate](CRMScript.NetServer.NSAssociate) - Created by user.

**Example:**

```crmscript theme={null}
NSRoleEntity thing;
NSAssociate createdBy = thing.GetCreatedBy();
```

## GetDataRights()

```crmscript theme={null}
NSDataRights GetDataRights()
```

**Returns:** [CRMScript.NetServer.NSDataRights](CRMScript.NetServer.NSDataRights) - Data rights matrix, defines role's access to data owned by current user, users in same group, and other users.

**Example:**

```crmscript theme={null}
NSRoleEntity thing;
NSDataRights dataRights = thing.GetDataRights();
```

## GetDeleted()

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

**Returns:** [CRMScript.Global.Integer](CRMScript.Global.Integer) - 1 if role has been deleted (we do not actually delete).

**Example:**

```crmscript theme={null}
NSRoleEntity thing;
Integer deleted = thing.GetDeleted();
```

## GetName()

```crmscript theme={null}
String GetName()
```

**Returns:** [CRMScript.Global.String](CRMScript.Global.String) - Visible role name.

**Example:**

```crmscript theme={null}
NSRoleEntity thing;
String name = thing.GetName();
```

## GetRank()

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

**Returns:** [CRMScript.Global.Integer](CRMScript.Global.Integer) - Sorting rank of this role in lists.

**Example:**

```crmscript theme={null}
NSRoleEntity thing;
Integer rank = thing.GetRank();
```

## GetRoleId()

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

**Returns:** [CRMScript.Global.Integer](CRMScript.Global.Integer) - Primary key.

**Example:**

```crmscript theme={null}
NSRoleEntity thing;
Integer roleId = thing.GetRoleId();
```

## GetRoleType()

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

**Returns:** [CRMScript.Global.Integer](CRMScript.Global.Integer) - The role type. See \<xref href="CRMScript.NetServer.RoleType" data-throw-if-not-resolved="false">\</xref>.

<Note>
  Changing this field has no effect, so treat this as a read-only field.
</Note>

**Example:**

```crmscript theme={null}
NSRoleEntity thing;
Integer roleType = thing.GetRoleType();
```

## GetTooltip()

```crmscript theme={null}
String GetTooltip()
```

**Returns:** [CRMScript.Global.String](CRMScript.Global.String) - Description of the role.

**Example:**

```crmscript theme={null}
NSRoleEntity thing;
String tooltip = thing.GetTooltip();
```

## GetUpdated()

```crmscript theme={null}
DateTime GetUpdated()
```

**Returns:** [CRMScript.Global.DateTime](CRMScript.Global.DateTime) - Last updated when.

**Example:**

```crmscript theme={null}
NSRoleEntity thing;
DateTime updated = thing.GetUpdated();
```

## GetUpdatedBy()

```crmscript theme={null}
NSAssociate GetUpdatedBy()
```

**Returns:** [CRMScript.NetServer.NSAssociate](CRMScript.NetServer.NSAssociate) - Last updated by user.

**Example:**

```crmscript theme={null}
NSRoleEntity thing;
NSAssociate updatedBy = thing.GetUpdatedBy();
```

## GetUseCategories()

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

**Returns:** [CRMScript.Global.Integer](CRMScript.Global.Integer) - Apply role category membership to users.

**Example:**

```crmscript theme={null}
NSRoleEntity thing;
Integer useCategories = thing.GetUseCategories();
```

## SetCreated(DateTime)

```crmscript theme={null}
Void SetCreated(DateTime created)
```

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

**Example:**

```crmscript theme={null}
NSRoleEntity thing;
DateTime created;
thing.SetCreated(created);
```

## SetCreatedBy(NSAssociate)

```crmscript theme={null}
Void SetCreatedBy(NSAssociate createdBy)
```

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

**Example:**

```crmscript theme={null}
NSRoleEntity thing;
NSAssociate createdBy;
thing.SetCreatedBy(createdBy);
```

## SetDataRights(NSDataRights)

```crmscript theme={null}
Void SetDataRights(NSDataRights dataRights)
```

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

**Example:**

```crmscript theme={null}
NSRoleEntity thing;
NSDataRights dataRights;
thing.SetDataRights(dataRights);
```

## SetDeleted(Integer)

```crmscript theme={null}
Void SetDeleted(Integer deleted)
```

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

**Example:**

```crmscript theme={null}
NSRoleEntity thing;
Integer deleted;
thing.SetDeleted(deleted);
```

## SetName(String)

```crmscript theme={null}
Void SetName(String name)
```

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

**Example:**

```crmscript theme={null}
NSRoleEntity thing;
String name;
thing.SetName(name);
```

## SetRank(Integer)

```crmscript theme={null}
Void SetRank(Integer rank)
```

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

**Example:**

```crmscript theme={null}
NSRoleEntity thing;
Integer rank;
thing.SetRank(rank);
```

## SetRoleId(Integer)

```crmscript theme={null}
Void SetRoleId(Integer roleId)
```

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

**Example:**

```crmscript theme={null}
NSRoleEntity thing;
Integer roleId;
thing.SetRoleId(roleId);
```

## SetRoleType(Integer)

```crmscript theme={null}
Void SetRoleType(Integer roleType)
```

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

**Example:**

```crmscript theme={null}
NSRoleEntity thing;
Integer roleType;
thing.SetRoleType(roleType);
```

## SetTooltip(String)

```crmscript theme={null}
Void SetTooltip(String tooltip)
```

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

**Example:**

```crmscript theme={null}
NSRoleEntity thing;
String tooltip;
thing.SetTooltip(tooltip);
```

## SetUpdated(DateTime)

```crmscript theme={null}
Void SetUpdated(DateTime updated)
```

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

**Example:**

```crmscript theme={null}
NSRoleEntity thing;
DateTime updated;
thing.SetUpdated(updated);
```

## SetUpdatedBy(NSAssociate)

```crmscript theme={null}
Void SetUpdatedBy(NSAssociate updatedBy)
```

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

**Example:**

```crmscript theme={null}
NSRoleEntity thing;
NSAssociate updatedBy;
thing.SetUpdatedBy(updatedBy);
```

## SetUseCategories(Integer)

```crmscript theme={null}
Void SetUseCategories(Integer useCategories)
```

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

**Example:**

```crmscript theme={null}
NSRoleEntity thing;
Integer useCategories;
thing.SetUseCategories(useCategories);
```


## Related topics

- [NSUserAgent](/en/automation/crmscript/reference/CRMScript.NetServer.NSUserAgent.md)
- [Get Role Entity](/en/api/reference/restful/rest/role/get-role-entity.md)
- [Post Role Entity](/en/api/reference/restful/rest/role/post-role-entity.md)
- [Default Role Entity](/en/api/reference/restful/rest/role/default-role-entity.md)
- [Put Role Entity](/en/api/reference/restful/rest/role/put-role-entity.md)
- [Save Role Entity](/en/api/reference/restful/agent/user_agent/save-role-entity.md)
