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

# SuperOffice.WebApi.Agents.CRMScriptAgent

# \<a id="SuperOffice\_WebApi\_Agents\_CRMScriptAgent">\</a> Class CRMScriptAgent

Namespace: [SuperOffice.WebApi.Agents](SuperOffice.WebApi.Agents.md)\
Assembly: SuperOffice.WebApi.dll

Manage and execute CRMScript functions.
\<p>\</p>
\<b>Online Restricted:\</b> This agent is not available in Online by default. Access must be requested specifically when app is registered.

```csharp theme={null}
public class CRMScriptAgent : AgentBase, ICRMScriptAgent, IAgentBase, IDisposable
```

#### Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) ←
[AgentBase](SuperOffice.WebApi.Agents.AgentBase.md) ←
[CRMScriptAgent](SuperOffice.WebApi.Agents.CRMScriptAgent.md)

#### Implements

[ICRMScriptAgent](SuperOffice.WebApi.Agents.ICRMScriptAgent.md),
[IAgentBase](SuperOffice.WebApi.Agents.IAgentBase.md),
[IDisposable](https://learn.microsoft.com/dotnet/api/system.idisposable)

#### Inherited Members

[AgentBase.\_json](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase__json),
[AgentBase.\_binary](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase__binary),
[AgentBase.\_config](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase__config),
[AgentBase.\_client](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase__client),
[AgentBase.\_disposeClient](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase__disposeClient),
[AgentBase.Merge(RequestOptions)](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_Merge_SuperOffice_WebApi_RequestOptions_),
[AgentBase.BuildRequestFromObject(HttpMethod, string, object, WebApiOptions, string)](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_BuildRequestFromObject_System_Net_Http_HttpMethod_System_String_System_Object_SuperOffice_WebApi_WebApiOptions_System_String_),
[AgentBase.BuildRequestFromStream(HttpMethod, string, Stream, WebApiOptions, string)](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_BuildRequestFromStream_System_Net_Http_HttpMethod_System_String_System_IO_Stream_SuperOffice_WebApi_WebApiOptions_System_String_),
[AgentBase.BuildRequestFromObjectWithStream(HttpMethod, string, object, Stream, WebApiOptions, string)](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_BuildRequestFromObjectWithStream_System_Net_Http_HttpMethod_System_String_System_Object_System_IO_Stream_SuperOffice_WebApi_WebApiOptions_System_String_),
[AgentBase.ParseAuthorization(IAuthorization)](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_ParseAuthorization_SuperOffice_WebApi_Authorization_IAuthorization_),
[AgentBase.CancelRequest()](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_CancelRequest),
[AgentBase.SendRequestObject(HttpMethod, string, object, WebApiOptions, string)](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_SendRequestObject_System_Net_Http_HttpMethod_System_String_System_Object_SuperOffice_WebApi_WebApiOptions_System_String_),
[AgentBase.SendRequestObjectWithStream(HttpMethod, string, object, Stream, WebApiOptions, string)](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_SendRequestObjectWithStream_System_Net_Http_HttpMethod_System_String_System_Object_System_IO_Stream_SuperOffice_WebApi_WebApiOptions_System_String_),
[AgentBase.SendRequest(HttpRequestMessage, RequestOptions)](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_SendRequest_System_Net_Http_HttpRequestMessage_SuperOffice_WebApi_RequestOptions_),
[AgentBase.ThrowOnResponseErrorAsync(HttpRequestMessage, HttpResponseMessage)](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_ThrowOnResponseErrorAsync_System_Net_Http_HttpRequestMessage_System_Net_Http_HttpResponseMessage_),
[AgentBase.ParseResponse\<T\&gt;(HttpResponseMessage)](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_ParseResponse__1_System_Net_Http_HttpResponseMessage_),
[AgentBase.Finally(RequestOptions)](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_Finally_SuperOffice_WebApi_RequestOptions_),
[AgentBase.Dispose()](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_Dispose),
[AgentBase.Configuration](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_Configuration),
[AgentBase.Client](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_Client),
[AgentBase.HasRunningRequest](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_HasRunningRequest),
[AgentBase.ClientCancellationTokenSource](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_ClientCancellationTokenSource),
[AgentBase.ProgressListener](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_ProgressListener),
[AgentBase.UploadProgressListener](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_UploadProgressListener),
[object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring),
[object.Equals(object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals\(system-object\)),
[object.Equals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals\(system-object-system-object\)),
[object.ReferenceEquals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.referenceequals),
[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode),
[object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype),
[object.MemberwiseClone()](https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone)

## Examples

\<pre>\<code class="lang-csharp">using SuperOffice.WebApi;
using SuperOffice.WebApi.Agents;

var mySession = new WebApiOptions("[http://example.com/super/api](http://example.com/super/api)");
mySession.Authorization = new AuthorizationUsernamePassword("user", "pass");
using (CRMScriptAgent agent = new CRMScriptAgent(mySession))
\{
// call methods on agent here...
}\</code>\</pre>

## Constructors

### \<a id="SuperOffice\_WebApi\_Agents\_CRMScriptAgent\_\_ctor\_System\_Net\_Http\_HttpClient\_">\</a> CRMScriptAgent(HttpClient)

Constructor: Manage and execute CRMScript functions.

```csharp theme={null}
public CRMScriptAgent(HttpClient httpClient)
```

#### Parameters

`httpClient` [HttpClient](https://learn.microsoft.com/dotnet/api/system.net.http.httpclient)

Use this HTTP client instead of making own HttpClient instance.

### \<a id="SuperOffice\_WebApi\_Agents\_CRMScriptAgent\_\_ctor\_SuperOffice\_WebApi\_WebApiOptions\_System\_Net\_Http\_HttpClient\_">\</a> CRMScriptAgent(WebApiOptions, HttpClient)

Constructor: Manage and execute CRMScript functions.

```csharp theme={null}
public CRMScriptAgent(WebApiOptions options, HttpClient httpClient = null)
```

#### Parameters

`options` [WebApiOptions](SuperOffice.WebApi.WebApiOptions.md)

Base URL and authentication values.

`httpClient` [HttpClient](https://learn.microsoft.com/dotnet/api/system.net.http.httpclient)

Optional: Use this HTTP client instead of making a new one.

## Methods

### \<a id="SuperOffice\_WebApi\_Agents\_CRMScriptAgent\_CreateDefaultCRMScriptEntityAsync\_SuperOffice\_WebApi\_RequestOptions\_">\</a> CreateDefaultCRMScriptEntityAsync(RequestOptions)

Set default values into a new CRMScriptEntity.
NetServer calculates default values on the entity, which is required when creating/storing a new instance

```csharp theme={null}
public Task<CRMScriptEntity> CreateDefaultCRMScriptEntityAsync(RequestOptions requestOptions = null)
```

#### Parameters

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[CRMScriptEntity](SuperOffice.WebApi.Data.CRMScriptEntity.md)\&gt;

A blank CRMScriptEntity

### \<a id="SuperOffice\_WebApi\_Agents\_CRMScriptAgent\_CreateDefaultTriggerScriptEntityAsync\_SuperOffice\_WebApi\_RequestOptions\_">\</a> CreateDefaultTriggerScriptEntityAsync(RequestOptions)

Set default values into a new TriggerScriptEntity.
NetServer calculates default values on the entity, which is required when creating/storing a new instance

```csharp theme={null}
public Task<TriggerScriptEntity> CreateDefaultTriggerScriptEntityAsync(RequestOptions requestOptions = null)
```

#### Parameters

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[TriggerScriptEntity](SuperOffice.WebApi.Data.TriggerScriptEntity.md)\&gt;

A blank TriggerScriptEntity

### \<a id="SuperOffice\_WebApi\_Agents\_CRMScriptAgent\_DeleteCRMScriptByUniqueIdentifierAsync\_System\_String\_SuperOffice\_WebApi\_RequestOptions\_">\</a> DeleteCRMScriptByUniqueIdentifierAsync(string, RequestOptions)

Delete the CRMScript
\<p>\</p>
\<b>Online Restricted:\</b> The CRMScript agent is not available in Online by default. Access must be requested specifically when app is registered.

```csharp theme={null}
public Task DeleteCRMScriptByUniqueIdentifierAsync(string uniqueIdentifier, RequestOptions requestOptions = null)
```

#### Parameters

`uniqueIdentifier` [string](https://learn.microsoft.com/dotnet/api/system.string)

Global unique reference to script (independent of installation)

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

This method has no return value

### \<a id="SuperOffice\_WebApi\_Agents\_CRMScriptAgent\_DeleteCRMScriptEntityAsync\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> DeleteCRMScriptEntityAsync(int, RequestOptions)

Deletes the CRMScriptEntity
\<p>\</p>
\<b>Online Restricted:\</b> The CRMScript agent is not available in Online by default. Access must be requested specifically when app is registered.

```csharp theme={null}
public Task DeleteCRMScriptEntityAsync(int cRMScriptEntityId, RequestOptions requestOptions = null)
```

#### Parameters

`cRMScriptEntityId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

The identity of the CRMScriptEntity

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

### \<a id="SuperOffice\_WebApi\_Agents\_CRMScriptAgent\_DeleteTriggerScriptByUniqueIdAsync\_System\_String\_SuperOffice\_WebApi\_RequestOptions\_">\</a> DeleteTriggerScriptByUniqueIdAsync(string, RequestOptions)

Delete a trigger CRMScript.
\<p>\</p>
\<b>Online Restricted:\</b> The CRMScript agent is not available in Online by default. Access must be requested specifically when app is registered.

```csharp theme={null}
public Task DeleteTriggerScriptByUniqueIdAsync(string triggerScriptUniqueId, RequestOptions requestOptions = null)
```

#### Parameters

`triggerScriptUniqueId` [string](https://learn.microsoft.com/dotnet/api/system.string)

The unique id of the CRMScript to validate

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

This method has no return value

### \<a id="SuperOffice\_WebApi\_Agents\_CRMScriptAgent\_DeleteTriggerScriptEntityAsync\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> DeleteTriggerScriptEntityAsync(int, RequestOptions)

Deletes the TriggerScriptEntity
\<p>\</p>
\<b>Online Restricted:\</b> The CRMScript agent is not available in Online by default. Access must be requested specifically when app is registered.

```csharp theme={null}
public Task DeleteTriggerScriptEntityAsync(int triggerScriptEntityId, RequestOptions requestOptions = null)
```

#### Parameters

`triggerScriptEntityId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

The identity of the TriggerScriptEntity

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

### \<a id="SuperOffice\_WebApi\_Agents\_CRMScriptAgent\_ExecuteScriptAsEventAsync\_System\_Int32\_SuperOffice\_WebApi\_Data\_EventData\_SuperOffice\_WebApi\_RequestOptions\_">\</a> ExecuteScriptAsEventAsync(int, EventData, RequestOptions)

Execute a CRMScript with event data as input. Returns event data with output variable values.
\<p>\</p>
\<b>Online Restricted:\</b> The CRMScript agent is not available in Online by default. Access must be requested specifically when app is registered.

```csharp theme={null}
public Task<EventData> ExecuteScriptAsEventAsync(int cRMScriptId, EventData eventData, RequestOptions requestOptions = null)
```

#### Parameters

`cRMScriptId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

The id of the CRMScript to execute

`eventData` [EventData](SuperOffice.WebApi.Data.EventData.md)

The EventData instance sent to the crmscript with input values

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[EventData](SuperOffice.WebApi.Data.EventData.md)\&gt;

The EventData instance after script execution with output values

### \<a id="SuperOffice\_WebApi\_Agents\_CRMScriptAgent\_ExecuteScriptAsEventByUniqueIdAsync\_System\_String\_SuperOffice\_WebApi\_Data\_EventData\_SuperOffice\_WebApi\_RequestOptions\_">\</a> ExecuteScriptAsEventByUniqueIdAsync(string, EventData, RequestOptions)

Execute a CRMScript with event data as input. Returns event data with output variable values.
\<p>\</p>
\<b>Online Restricted:\</b> The CRMScript agent is not available in Online by default. Access must be requested specifically when app is registered.

```csharp theme={null}
public Task<EventData> ExecuteScriptAsEventByUniqueIdAsync(string cRMScriptUniqueId, EventData eventData, RequestOptions requestOptions = null)
```

#### Parameters

`cRMScriptUniqueId` [string](https://learn.microsoft.com/dotnet/api/system.string)

The unique id of the CRMScript to execute

`eventData` [EventData](SuperOffice.WebApi.Data.EventData.md)

The EventData instance sent to the crmscript with input values

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[EventData](SuperOffice.WebApi.Data.EventData.md)\&gt;

The EventData instance after script execution with output values

### \<a id="SuperOffice\_WebApi\_Agents\_CRMScriptAgent\_ExecuteScriptAsync\_System\_Int32\_SuperOffice\_WebApi\_Data\_StringDictionary\_SuperOffice\_WebApi\_RequestOptions\_">\</a> ExecuteScriptAsync(int, StringDictionary, RequestOptions)

Execute a CRMScript with parameters, returning printed output value.
\<p>\</p>
\<b>Online Restricted:\</b> The CRMScript agent is not available in Online by default. Access must be requested specifically when app is registered.

```csharp theme={null}
public Task<string> ExecuteScriptAsync(int cRMScriptId, StringDictionary parameters, RequestOptions requestOptions = null)
```

#### Parameters

`cRMScriptId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

The id of the CRMScript to execute

`parameters` [StringDictionary](SuperOffice.WebApi.Data.StringDictionary.md)

Parameters passed as variables to the CRMScript

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[string](https://learn.microsoft.com/dotnet/api/system.string)\&gt;

The output produced by the CRMScript

### \<a id="SuperOffice\_WebApi\_Agents\_CRMScriptAgent\_ExecuteScriptByIncludeIdAsync\_System\_String\_SuperOffice\_WebApi\_Data\_StringDictionary\_SuperOffice\_WebApi\_RequestOptions\_">\</a> ExecuteScriptByIncludeIdAsync(string, StringDictionary, RequestOptions)

Execute a CRMScript with parameters, returning printed output value.
\<p>\</p>
\<b>Online Restricted:\</b> The CRMScript agent is not available in Online by default. Access must be requested specifically when app is registered.

```csharp theme={null}
public Task<string> ExecuteScriptByIncludeIdAsync(string cRMScriptIncludeId, StringDictionary parameters, RequestOptions requestOptions = null)
```

#### Parameters

`cRMScriptIncludeId` [string](https://learn.microsoft.com/dotnet/api/system.string)

The include id of the CRMScript to validate

`parameters` [StringDictionary](SuperOffice.WebApi.Data.StringDictionary.md)

Parameters passed as variables to the CRMScript

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[string](https://learn.microsoft.com/dotnet/api/system.string)\&gt;

The output produced by the CRMScript

### \<a id="SuperOffice\_WebApi\_Agents\_CRMScriptAgent\_ExecuteScriptByStringAsync\_System\_String\_SuperOffice\_WebApi\_Data\_StringDictionary\_SuperOffice\_WebApi\_Data\_EventData\_SuperOffice\_WebApi\_RequestOptions\_">\</a> ExecuteScriptByStringAsync(string, StringDictionary, EventData, RequestOptions)

Execute a CRMScript 2 (JavaScript), returning the printed output value.
\<p>\</p>
\<b>Online Restricted:\</b> The CRMScript agent is not available in Online by default. Access must be requested specifically when app is registered.

```csharp theme={null}
public Task<CRMScriptRunResult> ExecuteScriptByStringAsync(string script, StringDictionary parameters, EventData eventData, RequestOptions requestOptions = null)
```

#### Parameters

`script` [string](https://learn.microsoft.com/dotnet/api/system.string)

The script to execute

`parameters` [StringDictionary](SuperOffice.WebApi.Data.StringDictionary.md)

Parameters passed as variables to the CRMScript

`eventData` [EventData](SuperOffice.WebApi.Data.EventData.md)

The EventData instance sent to the crmscript with input values

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[CRMScriptRunResult](SuperOffice.WebApi.Data.CRMScriptRunResult.md)\&gt;

The output produced by the CRMScript

### \<a id="SuperOffice\_WebApi\_Agents\_CRMScriptAgent\_ExecuteScriptByUniqueIdAsync\_System\_String\_SuperOffice\_WebApi\_Data\_StringDictionary\_SuperOffice\_WebApi\_RequestOptions\_">\</a> ExecuteScriptByUniqueIdAsync(string, StringDictionary, RequestOptions)

Execute a CRMScript with parameters, returning printed output value.
\<p>\</p>
\<b>Online Restricted:\</b> The CRMScript agent is not available in Online by default. Access must be requested specifically when app is registered.

```csharp theme={null}
public Task<string> ExecuteScriptByUniqueIdAsync(string cRMScriptUniqueId, StringDictionary parameters, RequestOptions requestOptions = null)
```

#### Parameters

`cRMScriptUniqueId` [string](https://learn.microsoft.com/dotnet/api/system.string)

The unique id of the CRMScript to validate

`parameters` [StringDictionary](SuperOffice.WebApi.Data.StringDictionary.md)

Parameters passed as variables to the CRMScript

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[string](https://learn.microsoft.com/dotnet/api/system.string)\&gt;

The output produced by the CRMScript

### \<a id="SuperOffice\_WebApi\_Agents\_CRMScriptAgent\_GetCRMScriptByUniqueIdentifierAsync\_System\_String\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetCRMScriptByUniqueIdentifierAsync(string, RequestOptions)

Get information about a script from a unique identifier
\<p>\</p>
\<b>Online Restricted:\</b> The CRMScript agent is not available in Online by default. Access must be requested specifically when app is registered.

```csharp theme={null}
public Task<Script> GetCRMScriptByUniqueIdentifierAsync(string uniqueIdentifier, RequestOptions requestOptions = null)
```

#### Parameters

`uniqueIdentifier` [string](https://learn.microsoft.com/dotnet/api/system.string)

Global unique reference to script (independent of installation)

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[Script](SuperOffice.WebApi.Data.Script.md)\&gt;

Information about CRMScript

### \<a id="SuperOffice\_WebApi\_Agents\_CRMScriptAgent\_GetCRMScriptEntityAsync\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetCRMScriptEntityAsync(int, RequestOptions)

Gets a specific CRMScriptEntity object.
\<p>\</p>
\<b>Online Restricted:\</b> The CRMScript agent is not available in Online by default. Access must be requested specifically when app is registered.

```csharp theme={null}
public Task<CRMScriptEntity> GetCRMScriptEntityAsync(int cRMScriptEntityId, RequestOptions requestOptions = null)
```

#### Parameters

`cRMScriptEntityId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

The identifier of the CRMScriptEntity object

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[CRMScriptEntity](SuperOffice.WebApi.Data.CRMScriptEntity.md)\&gt;

CRMScriptEntity

### \<a id="SuperOffice\_WebApi\_Agents\_CRMScriptAgent\_GetTriggerScriptByUniqueIdAsync\_System\_String\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetTriggerScriptByUniqueIdAsync(string, RequestOptions)

Get a trigger CRMScript.
\<p>\</p>
\<b>Online Restricted:\</b> The CRMScript agent is not available in Online by default. Access must be requested specifically when app is registered.

```csharp theme={null}
public Task<TriggerScriptEntity> GetTriggerScriptByUniqueIdAsync(string triggerScriptUniqueId, RequestOptions requestOptions = null)
```

#### Parameters

`triggerScriptUniqueId` [string](https://learn.microsoft.com/dotnet/api/system.string)

The unique id of the CRMScript to validate

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[TriggerScriptEntity](SuperOffice.WebApi.Data.TriggerScriptEntity.md)\&gt;

Trigger script details and source code.

### \<a id="SuperOffice\_WebApi\_Agents\_CRMScriptAgent\_GetTriggerScriptEntityAsync\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetTriggerScriptEntityAsync(int, RequestOptions)

Gets a specific TriggerScriptEntity object.
\<p>\</p>
\<b>Online Restricted:\</b> The CRMScript agent is not available in Online by default. Access must be requested specifically when app is registered.

```csharp theme={null}
public Task<TriggerScriptEntity> GetTriggerScriptEntityAsync(int triggerScriptEntityId, RequestOptions requestOptions = null)
```

#### Parameters

`triggerScriptEntityId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

The identifier of the TriggerScriptEntity object

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[TriggerScriptEntity](SuperOffice.WebApi.Data.TriggerScriptEntity.md)\&gt;

TriggerScriptEntity

### \<a id="SuperOffice\_WebApi\_Agents\_CRMScriptAgent\_ResolveIncludesAsync\_System\_String\_System\_Boolean\_SuperOffice\_WebApi\_RequestOptions\_">\</a> ResolveIncludesAsync(string, bool, RequestOptions)

Will resolve all includes for a TypeScript and return an array of the IDs
\<p>\</p>
\<b>Online Restricted:\</b> The CRMScript agent is not available in Online by default. Access must be requested specifically when app is registered.

```csharp theme={null}
public Task<int[]> ResolveIncludesAsync(string script, bool ignoreErrors, RequestOptions requestOptions = null)
```

#### Parameters

`script` [string](https://learn.microsoft.com/dotnet/api/system.string)

The script to resolve includes for

`ignoreErrors` [bool](https://learn.microsoft.com/dotnet/api/system.boolean)

If true, then missing includes will be ignored

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[int](https://learn.microsoft.com/dotnet/api/system.int32)\[]\&gt;

The ids of all the included scripts

### \<a id="SuperOffice\_WebApi\_Agents\_CRMScriptAgent\_SaveCRMScriptByUniqueIdentifierAsync\_System\_String\_SuperOffice\_WebApi\_Data\_Script\_SuperOffice\_WebApi\_RequestOptions\_">\</a> SaveCRMScriptByUniqueIdentifierAsync(string, Script, RequestOptions)

Create or Update the CRMScript information
\<p>\</p>
\<b>Online Restricted:\</b> The CRMScript agent is not available in Online by default. Access must be requested specifically when app is registered.

```csharp theme={null}
public Task<Script> SaveCRMScriptByUniqueIdentifierAsync(string uniqueIdentifier, Script crmscript, RequestOptions requestOptions = null)
```

#### Parameters

`uniqueIdentifier` [string](https://learn.microsoft.com/dotnet/api/system.string)

Global unique reference to script (independent of installation)

`crmscript` [Script](SuperOffice.WebApi.Data.Script.md)

Information about the CRMScript

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[Script](SuperOffice.WebApi.Data.Script.md)\&gt;

Information about the CRMScript as saved in the database

### \<a id="SuperOffice\_WebApi\_Agents\_CRMScriptAgent\_SaveCRMScriptEntityAsync\_SuperOffice\_WebApi\_Data\_CRMScriptEntity\_SuperOffice\_WebApi\_RequestOptions\_">\</a> SaveCRMScriptEntityAsync(CRMScriptEntity, RequestOptions)

Updates the existing CRMScriptEntity or creates a new CRMScriptEntity if the id parameter is 0.
\<p>\</p>
\<b>Online Restricted:\</b> The CRMScript agent is not available in Online by default. Access must be requested specifically when app is registered.

```csharp theme={null}
public Task<CRMScriptEntity> SaveCRMScriptEntityAsync(CRMScriptEntity cRMScriptEntity, RequestOptions requestOptions = null)
```

#### Parameters

`cRMScriptEntity` [CRMScriptEntity](SuperOffice.WebApi.Data.CRMScriptEntity.md)

The CRMScriptEntity that is saved.

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[CRMScriptEntity](SuperOffice.WebApi.Data.CRMScriptEntity.md)\&gt;

New or updated CRMScriptEntity

### \<a id="SuperOffice\_WebApi\_Agents\_CRMScriptAgent\_SaveCRMScriptEntityWithoutCompileAsync\_SuperOffice\_WebApi\_Data\_CRMScriptEntity\_SuperOffice\_WebApi\_RequestOptions\_">\</a> SaveCRMScriptEntityWithoutCompileAsync(CRMScriptEntity, RequestOptions)

Save the script directly without compiling TypeScript
\<p>\</p>
\<b>Online Restricted:\</b> The CRMScript agent is not available in Online by default. Access must be requested specifically when app is registered.

```csharp theme={null}
public Task<CRMScriptEntity> SaveCRMScriptEntityWithoutCompileAsync(CRMScriptEntity crmScriptEntity, RequestOptions requestOptions = null)
```

#### Parameters

`crmScriptEntity` [CRMScriptEntity](SuperOffice.WebApi.Data.CRMScriptEntity.md)

The entity to save. Source and SourceCode should both be specified

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[CRMScriptEntity](SuperOffice.WebApi.Data.CRMScriptEntity.md)\&gt;

The saved entity

### \<a id="SuperOffice\_WebApi\_Agents\_CRMScriptAgent\_SaveTriggerScriptByUniqueIdAsync\_System\_String\_SuperOffice\_WebApi\_Data\_TriggerScriptEntity\_SuperOffice\_WebApi\_RequestOptions\_">\</a> SaveTriggerScriptByUniqueIdAsync(string, TriggerScriptEntity, RequestOptions)

Validate a CRMScript. This will check that the syntax is correct
\<p>\</p>
\<b>Online Restricted:\</b> The CRMScript agent is not available in Online by default. Access must be requested specifically when app is registered.

```csharp theme={null}
public Task<TriggerScriptEntity> SaveTriggerScriptByUniqueIdAsync(string triggerScriptUniqueId, TriggerScriptEntity entity, RequestOptions requestOptions = null)
```

#### Parameters

`triggerScriptUniqueId` [string](https://learn.microsoft.com/dotnet/api/system.string)

The unique id of the CRMScript to validate

`entity` [TriggerScriptEntity](SuperOffice.WebApi.Data.TriggerScriptEntity.md)

Trigger script details and source code

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[TriggerScriptEntity](SuperOffice.WebApi.Data.TriggerScriptEntity.md)\&gt;

Trigger script details and source code.

### \<a id="SuperOffice\_WebApi\_Agents\_CRMScriptAgent\_SaveTriggerScriptEntityAsync\_SuperOffice\_WebApi\_Data\_TriggerScriptEntity\_SuperOffice\_WebApi\_RequestOptions\_">\</a> SaveTriggerScriptEntityAsync(TriggerScriptEntity, RequestOptions)

Updates the existing TriggerScriptEntity or creates a new TriggerScriptEntity if the id parameter is 0.
\<p>\</p>
\<b>Online Restricted:\</b> The CRMScript agent is not available in Online by default. Access must be requested specifically when app is registered.

```csharp theme={null}
public Task<TriggerScriptEntity> SaveTriggerScriptEntityAsync(TriggerScriptEntity triggerScriptEntity, RequestOptions requestOptions = null)
```

#### Parameters

`triggerScriptEntity` [TriggerScriptEntity](SuperOffice.WebApi.Data.TriggerScriptEntity.md)

The TriggerScriptEntity that is saved.

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[TriggerScriptEntity](SuperOffice.WebApi.Data.TriggerScriptEntity.md)\&gt;

New or updated TriggerScriptEntity

### \<a id="SuperOffice\_WebApi\_Agents\_CRMScriptAgent\_ValidateScriptAsync\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> ValidateScriptAsync(int, RequestOptions)

Validate a CRMScript. This will check that the syntax is correct
\<p>\</p>
\<b>Online Restricted:\</b> The CRMScript agent is not available in Online by default. Access must be requested specifically when app is registered.

```csharp theme={null}
public Task<CRMScriptResult> ValidateScriptAsync(int cRMScriptId, RequestOptions requestOptions = null)
```

#### Parameters

`cRMScriptId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

The id of the CRMScript to execute

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[CRMScriptResult](SuperOffice.WebApi.Data.CRMScriptResult.md)\&gt;

True if the syntax is correct

### \<a id="SuperOffice\_WebApi\_Agents\_CRMScriptAgent\_ValidateScriptByIncludeIdAsync\_System\_String\_SuperOffice\_WebApi\_RequestOptions\_">\</a> ValidateScriptByIncludeIdAsync(string, RequestOptions)

Validate a CRMScript. This will check that the syntax is correct
\<p>\</p>
\<b>Online Restricted:\</b> The CRMScript agent is not available in Online by default. Access must be requested specifically when app is registered.

```csharp theme={null}
public Task<CRMScriptResult> ValidateScriptByIncludeIdAsync(string cRMScriptIncludeId, RequestOptions requestOptions = null)
```

#### Parameters

`cRMScriptIncludeId` [string](https://learn.microsoft.com/dotnet/api/system.string)

The include id of the CRMScript to validate

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[CRMScriptResult](SuperOffice.WebApi.Data.CRMScriptResult.md)\&gt;

True if the syntax is correct

### \<a id="SuperOffice\_WebApi\_Agents\_CRMScriptAgent\_ValidateScriptByStringAsync\_System\_String\_SuperOffice\_WebApi\_RequestOptions\_">\</a> ValidateScriptByStringAsync(string, RequestOptions)

Validate a CRMScript 2 (JavaScript). This will check that the syntax is correct
\<p>\</p>
\<b>Online Restricted:\</b> The CRMScript agent is not available in Online by default. Access must be requested specifically when app is registered.

```csharp theme={null}
public Task<CRMScriptResult> ValidateScriptByStringAsync(string script, RequestOptions requestOptions = null)
```

#### Parameters

`script` [string](https://learn.microsoft.com/dotnet/api/system.string)

The script to validate

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[CRMScriptResult](SuperOffice.WebApi.Data.CRMScriptResult.md)\&gt;

The result of the syntax check

### \<a id="SuperOffice\_WebApi\_Agents\_CRMScriptAgent\_ValidateScriptByUniqueIdAsync\_System\_String\_SuperOffice\_WebApi\_RequestOptions\_">\</a> ValidateScriptByUniqueIdAsync(string, RequestOptions)

Validate a CRMScript. This will check that the syntax is correct
\<p>\</p>
\<b>Online Restricted:\</b> The CRMScript agent is not available in Online by default. Access must be requested specifically when app is registered.

```csharp theme={null}
public Task<CRMScriptResult> ValidateScriptByUniqueIdAsync(string cRMScriptUniqueId, RequestOptions requestOptions = null)
```

#### Parameters

`cRMScriptUniqueId` [string](https://learn.microsoft.com/dotnet/api/system.string)

The unique id of the CRMScript to validate

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[CRMScriptResult](SuperOffice.WebApi.Data.CRMScriptResult.md)\&gt;

True if the syntax is correct

### \<a id="SuperOffice\_WebApi\_Agents\_CRMScriptAgent\_ValidateTriggerScriptAsync\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> ValidateTriggerScriptAsync(int, RequestOptions)

Validate a Trigger CRMScript. This will check that the syntax is correct, but not execute the script.
\<p>\</p>
\<b>Online Restricted:\</b> The CRMScript agent is not available in Online by default. Access must be requested specifically when app is registered.

```csharp theme={null}
public Task<CRMScriptResult> ValidateTriggerScriptAsync(int triggerScriptId, RequestOptions requestOptions = null)
```

#### Parameters

`triggerScriptId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

The id of the CRMScript Trigger to validate

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[CRMScriptResult](SuperOffice.WebApi.Data.CRMScriptResult.md)\&gt;

True if the syntax is correct

### \<a id="SuperOffice\_WebApi\_Agents\_CRMScriptAgent\_ValidateTriggerScriptByUniqueIdAsync\_System\_String\_SuperOffice\_WebApi\_RequestOptions\_">\</a> ValidateTriggerScriptByUniqueIdAsync(string, RequestOptions)

Validate a Trigger CRMScript. This will check that the syntax is correct, but not execute the script.
\<p>\</p>
\<b>Online Restricted:\</b> The CRMScript agent is not available in Online by default. Access must be requested specifically when app is registered.

```csharp theme={null}
public Task<CRMScriptResult> ValidateTriggerScriptByUniqueIdAsync(string triggerScriptUniqueId, RequestOptions requestOptions = null)
```

#### Parameters

`triggerScriptUniqueId` [string](https://learn.microsoft.com/dotnet/api/system.string)

The unique id of the CRMScript to validate

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[CRMScriptResult](SuperOffice.WebApi.Data.CRMScriptResult.md)\&gt;

True if the syntax is correct


## Related topics

- [SuperOffice.WebApi.Data.Script](/en/api/reference/webapi/SuperOffice.WebApi.Data.Script.md)
- [SuperOffice.WebApi.Data.CRMScriptEntity](/en/api/reference/webapi/SuperOffice.WebApi.Data.CRMScriptEntity.md)
- [SuperOffice.WebApi.Data.TriggerScriptEntity](/en/api/reference/webapi/SuperOffice.WebApi.Data.TriggerScriptEntity.md)
- [SuperOffice.WebApi.Data.CRMScriptResult](/en/api/reference/webapi/SuperOffice.WebApi.Data.CRMScriptResult.md)
- [SuperOffice.WebApi.Data.CRMScriptRunResult](/en/api/reference/webapi/SuperOffice.WebApi.Data.CRMScriptRunResult.md)
- [SuperOffice.WebApi.Data.CRMScriptSourceMap](/en/api/reference/webapi/SuperOffice.WebApi.Data.CRMScriptSourceMap.md)
