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

# NSHistory

> The usage history of the currently logged in user is represented as History objects.

The usage history of the currently logged in user is represented as History objects.

## Constructors

### NSHistory()

```crmscript theme={null}
NSHistory
```

Initializes a new instance of the NSHistory class.

## Methods

## GetAssociateId()

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

**Returns:** [CRMScript.Global.Integer](CRMScript.Global.Integer) - Owner of history list.

**Example:**

```crmscript theme={null}
NSHistory thing;
Integer associateId = thing.GetAssociateId();
```

## GetHistoryId()

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

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

**Example:**

```crmscript theme={null}
NSHistory thing;
Integer historyId = thing.GetHistoryId();
```

## GetHistoryName()

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

**Returns:** [CRMScript.Global.String](CRMScript.Global.String) - The name of the history list, for instance contact. Represents the history table's TableId field.

**Example:**

```crmscript theme={null}
NSHistory thing;
String historyName = thing.GetHistoryName();
```

## GetId()

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

**Returns:** [CRMScript.Global.Integer](CRMScript.Global.Integer) - ID of the history item, for instance a contact id. Represents the history table's RecordId field, if the item is based on a history table record.

**Example:**

```crmscript theme={null}
NSHistory thing;
Integer id = thing.GetId();
```

## GetItemInfo()

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

**Returns:** [CRMScript.Global.String](CRMScript.Global.String) - Extra information on the history item, e.g. The Associate Type for an associate or other relevant info.

**Example:**

```crmscript theme={null}
NSHistory thing;
String itemInfo = thing.GetItemInfo();
```

## GetName()

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

**Returns:** [CRMScript.Global.String](CRMScript.Global.String) - Name of the history item, for instance contact name.

**Example:**

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

## GetRank()

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

**Returns:** [CRMScript.Global.Integer](CRMScript.Global.Integer) - Sort order, indexed so it can used for sorting in the query.

**Example:**

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

## SetAssociateId(Integer)

```crmscript theme={null}
Void SetAssociateId(Integer associateId)
```

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

**Example:**

```crmscript theme={null}
NSHistory thing;
Integer associateId;
thing.SetAssociateId(associateId);
```

## SetHistoryId(Integer)

```crmscript theme={null}
Void SetHistoryId(Integer historyId)
```

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

**Example:**

```crmscript theme={null}
NSHistory thing;
Integer historyId;
thing.SetHistoryId(historyId);
```

## SetHistoryName(String)

```crmscript theme={null}
Void SetHistoryName(String historyName)
```

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

**Example:**

```crmscript theme={null}
NSHistory thing;
String historyName;
thing.SetHistoryName(historyName);
```

## SetId(Integer)

```crmscript theme={null}
Void SetId(Integer id)
```

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

**Example:**

```crmscript theme={null}
NSHistory thing;
Integer id;
thing.SetId(id);
```

## SetItemInfo(String)

```crmscript theme={null}
Void SetItemInfo(String itemInfo)
```

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

**Example:**

```crmscript theme={null}
NSHistory thing;
String itemInfo;
thing.SetItemInfo(itemInfo);
```

## SetName(String)

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

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

**Example:**

```crmscript theme={null}
NSHistory 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}
NSHistory thing;
Integer rank;
thing.SetRank(rank);
```


## Related topics

- [NSViewStateAgent](/en/automation/crmscript/reference/CRMScript.NetServer.NSViewStateAgent.md)
- [NSHistoryRequest](/en/automation/crmscript/reference/CRMScript.NetServer.NSHistoryRequest.md)
- [History](/en/api/reference/restful/rest/sale/history.md)
- [Save Histories](/en/api/reference/restful/agent/viewstate_agent/save-histories.md)
- [The History list](/en/learn/basics/history.md)
- [History table](/en/database/tables/history.md)
