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

# NSDocumentTemplate

> The template a document is based on is stored in the SO arc\template folder on the server. This will return the name as displayed in the GUI, and not the physical document name, of the template the document object is based on.

The template a document is based on is stored in the SO\_arc\template folder on the server. This will return the name as displayed in the GUI, and not the physical document name, of the template the document object is based on.

## Constructors

### NSDocumentTemplate()

```crmscript theme={null}
NSDocumentTemplate
```

Initializes a new instance of the NSDocumentTemplate class.

## Methods

## GetAutoeventId()

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

**Returns:** [CRMScript.Global.Integer](CRMScript.Global.Integer) - Which document plugin is responsible for the documents generated from this template.

**Example:**

```crmscript theme={null}
NSDocumentTemplate thing;
Integer autoeventId = thing.GetAutoeventId();
```

## GetDefaultOref()

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

**Returns:** [CRMScript.Global.String](CRMScript.Global.String) - Processed via tag substitution to give document reference.

**Example:**

```crmscript theme={null}
NSDocumentTemplate thing;
String defaultOref = thing.GetDefaultOref();
```

## GetDeleted()

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

**Returns:** [CRMScript.Global.Integer](CRMScript.Global.Integer) - 0 -> record is active 1 -> record is 'deleted' and should not be shown in lists.

**Example:**

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

## GetDirection()

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

**Returns:** [CRMScript.Global.Integer](CRMScript.Global.Integer) - 1 = incoming, 2 = outgoing. See \<xref href="CRMScript.NetServer.TaskDirection" data-throw-if-not-resolved="false">\</xref>

**Example:**

```crmscript theme={null}
NSDocumentTemplate thing;
Integer direction = thing.GetDirection();
```

## GetDocumentTemplateId()

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

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

**Example:**

```crmscript theme={null}
NSDocumentTemplate thing;
Integer documentTemplateId = thing.GetDocumentTemplateId();
```

## GetFilename()

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

**Returns:** [CRMScript.Global.String](CRMScript.Global.String) - Relative to TemplatePath.

**Example:**

```crmscript theme={null}
NSDocumentTemplate thing;
String filename = thing.GetFilename();
```

## GetName()

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

**Returns:** [CRMScript.Global.String](CRMScript.Global.String) - The list item.

**Example:**

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

## GetQuoteDocType()

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

**Returns:** [CRMScript.Global.Integer](CRMScript.Global.Integer) - What type of quote document is this? See \<xref href="CRMScript.NetServer.DocTmplQuoteType" data-throw-if-not-resolved="false">\</xref>

**Example:**

```crmscript theme={null}
NSDocumentTemplate thing;
NSDocTmplQuoteType quoteDocType = thing.GetQuoteDocType();
```

## GetRecordType()

```crmscript theme={null}
NSDocTmplType GetRecordType()
```

**Returns:** [CRMScript.NetServer.NSDocTmplType](CRMScript.NetServer.NSDocTmplType) - 1 = app, 2 = doc, 3 = email, 4 = fax, 5 = phone, 6 = todo See \<xref href="CRMScript.NetServer.TaskType" data-throw-if-not-resolved="false">\</xref>

**Example:**

```crmscript theme={null}
NSDocumentTemplate thing;
NSDocTmplType recordType = thing.GetRecordType();
```

## GetSaveInDb()

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

**Returns:** [CRMScript.Global.Integer](CRMScript.Global.Integer) - 1 = save document records in DB; otherwise not.

**Example:**

```crmscript theme={null}
NSDocumentTemplate thing;
Integer saveInDb = thing.GetSaveInDb();
```

## GetTooltip()

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

**Returns:** [CRMScript.Global.String](CRMScript.Global.String) - Tooltip or other description.

**Example:**

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

## SetAutoeventId(Integer)

```crmscript theme={null}
Void SetAutoeventId(Integer autoeventId)
```

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

**Example:**

```crmscript theme={null}
NSDocumentTemplate thing;
Integer autoeventId;
thing.SetAutoeventId(autoeventId);
```

## SetDefaultOref(String)

```crmscript theme={null}
Void SetDefaultOref(String defaultOref)
```

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

**Example:**

```crmscript theme={null}
NSDocumentTemplate thing;
String defaultOref;
thing.SetDefaultOref(defaultOref);
```

## SetDeleted(Integer)

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

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

**Example:**

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

## SetDirection(Integer)

Sets the direction of a document template

```crmscript theme={null}
Void SetDirection(Integer direction)
```

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

**Example:**

```crmscript theme={null}
NSDocumentTemplate thing;
Integer direction;
thing.SetDirection(direction);
```

## SetDocumentTemplateId(Integer)

```crmscript theme={null}
Void SetDocumentTemplateId(Integer documentTemplateId)
```

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

**Example:**

```crmscript theme={null}
NSDocumentTemplate thing;
Integer documentTemplateId;
thing.SetDocumentTemplateId(documentTemplateId);
```

## SetFilename(String)

```crmscript theme={null}
Void SetFilename(String filename)
```

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

**Example:**

```crmscript theme={null}
NSDocumentTemplate thing;
String filename;
thing.SetFilename(filename);
```

## SetName(String)

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

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

**Example:**

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

## SetQuoteDocType(Integer)

```crmscript theme={null}
Void SetQuoteDocType(Integer quoteDocType)
```

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

**Example:**

```crmscript theme={null}
NSDocumentTemplate thing;
Integer quoteDocType;
thing.SetQuoteDocType(quoteDocType);
```

## SetRecordType(NSDocTmplType)

```crmscript theme={null}
Void SetRecordType(NSDocTmplType recordType)
```

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

**Example:**

```crmscript theme={null}
NSDocumentTemplate thing;
NSDocTmplType recordType;
thing.SetRecordType(recordType);
```

## SetSaveInDb(Integer)

```crmscript theme={null}
Void SetSaveInDb(Integer saveInDb)
```

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

**Example:**

```crmscript theme={null}
NSDocumentTemplate thing;
Integer saveInDb;
thing.SetSaveInDb(saveInDb);
```

## SetTooltip(String)

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

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

**Example:**

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


## Related topics

- [Document templates](/en/automation/crmscript/howto/document/templates.md)
- [NSDocumentEntity](/en/automation/crmscript/reference/CRMScript.NetServer.NSDocumentEntity.md)
- [NSSuggestedDocumentEntity](/en/automation/crmscript/reference/CRMScript.NetServer.NSSuggestedDocumentEntity.md)
- [NSListAgent](/en/automation/crmscript/reference/CRMScript.NetServer.NSListAgent.md)
- [Namespace CRMScript.NetServer](/en/automation/crmscript/reference/CRMScript.NetServer.md)
- [NSDocumentTemplateEntity](/en/automation/crmscript/reference/CRMScript.NetServer.NSDocumentTemplateEntity.md)
