> ## Documentation Index
> Fetch the complete documentation index at: https://superofficeas-bugfix-ty-screen-designer-paradox.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# NSNumberAllocationAgent

> This agent can be used to manage number allocation.

This agent can be used to manage number allocation.

## Constructors

### NSNumberAllocationAgent()

```crmscript theme={null}
NSNumberAllocationAgent
```

This agent can be used to manage number allocation.

## Methods

## CreateDefaultRefCountEntity()

Sets default values into a new NSRefCountEntity.

```crmscript theme={null}
NSRefCountEntity CreateDefaultRefCountEntity()
```

**Returns:** [CRMScript.NetServer.NSRefCountEntity](CRMScript.NetServer.NSRefCountEntity)

<Note>
  NetServer calculates default values (for example, Country) on the entity, which is required when creating/storing a new instance
</Note>

**Example:**

```crmscript theme={null}
NSNumberAllocationAgent agent;
NSRefCountEntity thing = agent.CreateDefaultRefCountEntity();
thing = agent.SaveRefCountEntity(thing);
```

## DeleteRefCountEntity(Integer)

Deletes the NSRefCountEntity

```crmscript theme={null}
DeleteRefCountEntity(Integer refCountEntity)
```

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

**Example:**

```crmscript theme={null}
NSNumberAllocationAgent agent;
agent.DeleteRefCountEntity(123);
```

## GetNumberEachTemplate()

Returns true or false if Automatically create new counters for new document templates

```crmscript theme={null}
Bool GetNumberEachTemplate()
```

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

**Example:**

```crmscript theme={null}
NSNumberAllocationAgent agent;
Bool res = agent.GetNumberEachTemplate();
```

## GetRefCountEntity(Integer)

Gets an NSRefCountEntity object.

```crmscript theme={null}
NSRefCountEntity GetRefCountEntity(Integer refCountEntityId)
```

**Returns:** [CRMScript.NetServer.NSRefCountEntity](CRMScript.NetServer.NSRefCountEntity)

**Example:**

```crmscript theme={null}
NSNumberAllocationAgent agent;
NSRefCountEntity thing = agent.GetRefCountEntity(123);
```

## SaveDefaultNumbering(NSRefCountEntity)

Saves default numbering values in preferences

```crmscript theme={null}
Void SaveDefaultNumbering(NSRefCountEntity refCountEntity)
```

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

**Example:**

```crmscript theme={null}
NSNumberAllocationAgent agent;
NSRefCountEntity refCountEntity;
agent.SaveDefaultNumbering(NSRefCountEntity);
```

## SaveRefCountEntity(NSRefCountEntity)

Updates the existing NSRefCountEntity or creates a new NSRefCountEntity if the id parameter is 0

```crmscript theme={null}
NSRefCountEntity SaveRefCountEntity(NSRefCountEntity refCountEntity)
```

**Returns:** [CRMScript.NetServer.NSRefCountEntity](CRMScript.NetServer.NSRefCountEntity)

**Example:**

```crmscript theme={null}
NSNumberAllocation  agent;
NSRefCountEntity thing = agent.CreateDefaultRefCountEntity();
thing = agent.SaveRefCountEntity(thing);
```

## SetNumberEachTemplate(Bool)

Saves true or false if Automatically create new counters for new document templates

```crmscript theme={null}
Void SetNumberEachTemplate(Bool setValue)
```

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

**Example:**

```crmscript theme={null}
NSNumberAllocationAgent agent;
Bool setValue;
agent.SetNumberEachTemplate(setValue);
```
