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

# NSTemporaryKeyInfo

> The fields returned when checking a temporary key.

The fields returned when checking a temporary key.

## Constructors

### NSTemporaryKeyInfo()

```crmscript theme={null}
NSTemporaryKeyInfo
```

Initializes a new instance of the NSTemporaryKeyInfo class.

## Methods

## GetDomain()

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

**Returns:** [CRMScript.Global.Integer](CRMScript.Global.Integer) - The domain for this key. Unknown if key is not valid. See \<xref href="CRMScript.NetServer.TemporaryKeyDomain" data-throw-if-not-resolved="false">\</xref>.

**Example:**

```crmscript theme={null}
NSTemporaryKeyInfo thing;
Integer domain = thing.GetDomain();
```

## GetIsExpired()

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

**Returns:** [CRMScript.Global.Bool](CRMScript.Global.Bool) - Whether the key is expired or not.

**Example:**

```crmscript theme={null}
NSTemporaryKeyInfo thing;
Bool isExpired = thing.GetIsExpired();
```

## GetPersonId()

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

**Returns:** [CRMScript.Global.Integer](CRMScript.Global.Integer) - The person ID this key is related to. May be null.

**Example:**

```crmscript theme={null}
NSTemporaryKeyInfo thing;
Integer personId = thing.GetPersonId();
```

## GetTargetId()

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

**Returns:** [CRMScript.Global.Integer](CRMScript.Global.Integer) - The primary key of the entity this temporary key is for, dependent of domain.

**Example:**

```crmscript theme={null}
NSTemporaryKeyInfo thing;
Integer targetId = thing.GetTargetId();
```

## SetDomain(Integer)

```crmscript theme={null}
Void SetDomain(Integer domain)
```

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

**Example:**

```crmscript theme={null}
NSTemporaryKeyInfo thing;
Integer domain;
thing.SetDomain(domain);
```

## SetIsExpired(Bool)

```crmscript theme={null}
Void SetIsExpired(Bool isExpired)
```

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

**Example:**

```crmscript theme={null}
NSTemporaryKeyInfo thing;
Bool isExpired;
thing.SetIsExpired(isExpired);
```

## SetPersonId(Integer)

```crmscript theme={null}
Void SetPersonId(Integer personId)
```

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

**Example:**

```crmscript theme={null}
NSTemporaryKeyInfo thing;
Integer personId;
thing.SetPersonId(personId);
```

## SetTargetId(Integer)

```crmscript theme={null}
Void SetTargetId(Integer targetId)
```

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

**Example:**

```crmscript theme={null}
NSTemporaryKeyInfo thing;
Integer targetId;
thing.SetTargetId(targetId);
```


## Related topics

- [NSPersonAgent](/en/automation/crmscript/reference/CRMScript.NetServer.NSPersonAgent.md)
- [SuperOffice.WebApi.Data.TemporaryKeyInfo](/en/api/reference/webapi/SuperOffice.WebApi.Data.TemporaryKeyInfo.md)
- [Create Temporary Key](/en/api/reference/restful/agent/person_agent/create-temporary-key.md)
- [Check Temporary Key](/en/api/reference/restful/agent/person_agent/check-temporary-key.md)
- [TemporaryKey table](/en/database/tables/temporarykey.md)
- [Create Temporary Key With Payload](/en/api/reference/restful/agent/person_agent/create-temporary-key-with-payload.md)
