Show / Hide Table of Contents

Interface ICRMScriptAgent

Interface for the CRMScript Agent Manage and execute CRMScript functions.

Online Restricted: This agent is not available in Online by default. Access must be requested specifically when app is registered.
Syntax
[Agent("CRMScript Agent", "Interface for the CRMScript Agent. Manage and execute CRMScript functions.")]
public interface ICRMScriptAgent : IAgent
Examples
using SuperOffice;
using SuperOffice.CRM.Services;

using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
   using (CRMScriptAgent agent = new CRMScriptAgent())
   {
      // call methods on agent here...
   }
}

Methods

CreateDefaultCRMScriptEntityAsync(CancellationToken)

Loading default values into a new CRMScriptEntity. NetServer calculates default values (e.g. Country) on the entity, which is required when creating/storing a new instance

Online Restricted: The CRMScript agent is not available in Online by default. Access must be requested specifically when app is registered.
Declaration
Task<CRMScriptEntity> CreateDefaultCRMScriptEntityAsync(CancellationToken cancellationToken = default)
Parameters
Type Name Description
CancellationToken cancellationToken
Returns
Type Description
Task<CRMScriptEntity>

New CRMScriptEntity with default values

CreateDefaultTriggerScriptEntityAsync(CancellationToken)

Loading default values into a new TriggerScriptEntity. NetServer calculates default values (e.g. Country) on the entity, which is required when creating/storing a new instance

Online Restricted: The CRMScript agent is not available in Online by default. Access must be requested specifically when app is registered.
Declaration
Task<TriggerScriptEntity> CreateDefaultTriggerScriptEntityAsync(CancellationToken cancellationToken = default)
Parameters
Type Name Description
CancellationToken cancellationToken
Returns
Type Description
Task<TriggerScriptEntity>

New TriggerScriptEntity with default values

DeleteCRMScriptByUniqueIdentifierAsync(string, CancellationToken)

Delete the CRMScript

Online Restricted: The CRMScript agent is not available in Online by default. Access must be requested specifically when app is registered.
Declaration
Task DeleteCRMScriptByUniqueIdentifierAsync(string uniqueIdentifier, CancellationToken cancellationToken = default)
Parameters
Type Name Description
string uniqueIdentifier

Global unique reference to script (independent of installation)

CancellationToken cancellationToken
Returns
Type Description
Task

This method has no return value

DeleteCRMScriptEntityAsync(int, CancellationToken)

Deletes the CRMScriptEntity

Online Restricted: The CRMScript agent is not available in Online by default. Access must be requested specifically when app is registered.
Declaration
Task DeleteCRMScriptEntityAsync(int cRMScriptEntityId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int cRMScriptEntityId

The identity of the CRMScriptEntity

CancellationToken cancellationToken
Returns
Type Description
Task

DeleteTriggerScriptByUniqueIdAsync(string, CancellationToken)

Delete a trigger CRMScript.

Online Restricted: The CRMScript agent is not available in Online by default. Access must be requested specifically when app is registered.
Declaration
Task DeleteTriggerScriptByUniqueIdAsync(string triggerScriptUniqueId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
string triggerScriptUniqueId

The unique id of the CRMScript to validate

CancellationToken cancellationToken
Returns
Type Description
Task

This method has no return value

DeleteTriggerScriptEntityAsync(int, CancellationToken)

Deletes the TriggerScriptEntity

Online Restricted: The CRMScript agent is not available in Online by default. Access must be requested specifically when app is registered.
Declaration
Task DeleteTriggerScriptEntityAsync(int triggerScriptEntityId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int triggerScriptEntityId

The identity of the TriggerScriptEntity

CancellationToken cancellationToken
Returns
Type Description
Task

ExecuteScriptAsEventAsync(int, EventData, CancellationToken)

Execute a CRMScript with event data as input. Returns event data with output variable values.

Online Restricted: The CRMScript agent is not available in Online by default. Access must be requested specifically when app is registered.
Declaration
Task<EventData> ExecuteScriptAsEventAsync(int cRMScriptId, EventData eventData, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int cRMScriptId

The id of the CRMScript to execute

EventData eventData

The EventData instance sent to the crmscript with input values

CancellationToken cancellationToken
Returns
Type Description
Task<EventData>

The EventData instance after script execution with output values

ExecuteScriptAsEventByUniqueIdAsync(string, EventData, CancellationToken)

Execute a CRMScript with event data as input. Returns event data with output variable values.

Online Restricted: The CRMScript agent is not available in Online by default. Access must be requested specifically when app is registered.
Declaration
Task<EventData> ExecuteScriptAsEventByUniqueIdAsync(string cRMScriptUniqueId, EventData eventData, CancellationToken cancellationToken = default)
Parameters
Type Name Description
string cRMScriptUniqueId

The unique id of the CRMScript to execute

EventData eventData

The EventData instance sent to the crmscript with input values

CancellationToken cancellationToken
Returns
Type Description
Task<EventData>

The EventData instance after script execution with output values

ExecuteScriptAsync(int, StringDictionary, CancellationToken)

Execute a CRMScript with parameters, returning printed output value.

Online Restricted: The CRMScript agent is not available in Online by default. Access must be requested specifically when app is registered.
Declaration
Task<string> ExecuteScriptAsync(int cRMScriptId, StringDictionary parameters, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int cRMScriptId

The id of the CRMScript to execute

StringDictionary parameters

Parameters passed as variables to the CRMScript

CancellationToken cancellationToken
Returns
Type Description
Task<string>

The output produced by the CRMScript

ExecuteScriptByIncludeIdAsync(string, StringDictionary, CancellationToken)

Execute a CRMScript with parameters, returning printed output value.

Online Restricted: The CRMScript agent is not available in Online by default. Access must be requested specifically when app is registered.
Declaration
Task<string> ExecuteScriptByIncludeIdAsync(string cRMScriptIncludeId, StringDictionary parameters, CancellationToken cancellationToken = default)
Parameters
Type Name Description
string cRMScriptIncludeId

The include id of the CRMScript to validate

StringDictionary parameters

Parameters passed as variables to the CRMScript

CancellationToken cancellationToken
Returns
Type Description
Task<string>

The output produced by the CRMScript

ExecuteScriptByStringAsync(string, StringDictionary, EventData, CancellationToken)

Execute a CRMScript 2 (JavaScript), returning the printed output value.

Online Restricted: The CRMScript agent is not available in Online by default. Access must be requested specifically when app is registered.
Declaration
Task<CRMScriptRunResult> ExecuteScriptByStringAsync(string script, StringDictionary parameters, EventData eventData, CancellationToken cancellationToken = default)
Parameters
Type Name Description
string script

The script to execute

StringDictionary parameters

Parameters passed as variables to the CRMScript

EventData eventData

The EventData instance sent to the crmscript with input values

CancellationToken cancellationToken
Returns
Type Description
Task<CRMScriptRunResult>

The output produced by the CRMScript

ExecuteScriptByUniqueIdAsync(string, StringDictionary, CancellationToken)

Execute a CRMScript with parameters, returning printed output value.

Online Restricted: The CRMScript agent is not available in Online by default. Access must be requested specifically when app is registered.
Declaration
Task<string> ExecuteScriptByUniqueIdAsync(string cRMScriptUniqueId, StringDictionary parameters, CancellationToken cancellationToken = default)
Parameters
Type Name Description
string cRMScriptUniqueId

The unique id of the CRMScript to validate

StringDictionary parameters

Parameters passed as variables to the CRMScript

CancellationToken cancellationToken
Returns
Type Description
Task<string>

The output produced by the CRMScript

GetCRMScriptByUniqueIdentifierAsync(string, CancellationToken)

Get information about a script from a unique identifier

Online Restricted: The CRMScript agent is not available in Online by default. Access must be requested specifically when app is registered.
Declaration
Task<Script> GetCRMScriptByUniqueIdentifierAsync(string uniqueIdentifier, CancellationToken cancellationToken = default)
Parameters
Type Name Description
string uniqueIdentifier

Global unique reference to script (independent of installation)

CancellationToken cancellationToken
Returns
Type Description
Task<Script>

Information about CRMScript

GetCRMScriptEntityAsync(int, CancellationToken)

Gets a CRMScriptEntity object.

Online Restricted: The CRMScript agent is not available in Online by default. Access must be requested specifically when app is registered.
Declaration
Task<CRMScriptEntity> GetCRMScriptEntityAsync(int cRMScriptEntityId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int cRMScriptEntityId

The identifier of the CRMScriptEntity object

CancellationToken cancellationToken
Returns
Type Description
Task<CRMScriptEntity>

CRMScriptEntity

GetTriggerScriptByUniqueIdAsync(string, CancellationToken)

Get a trigger CRMScript.

Online Restricted: The CRMScript agent is not available in Online by default. Access must be requested specifically when app is registered.
Declaration
Task<TriggerScriptEntity> GetTriggerScriptByUniqueIdAsync(string triggerScriptUniqueId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
string triggerScriptUniqueId

The unique id of the CRMScript to validate

CancellationToken cancellationToken
Returns
Type Description
Task<TriggerScriptEntity>

Trigger script details and source code.

GetTriggerScriptEntityAsync(int, CancellationToken)

Gets a TriggerScriptEntity object.

Online Restricted: The CRMScript agent is not available in Online by default. Access must be requested specifically when app is registered.
Declaration
Task<TriggerScriptEntity> GetTriggerScriptEntityAsync(int triggerScriptEntityId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int triggerScriptEntityId

The identifier of the TriggerScriptEntity object

CancellationToken cancellationToken
Returns
Type Description
Task<TriggerScriptEntity>

TriggerScriptEntity

ResolveIncludesAsync(string, bool, CancellationToken)

Will resolve all includes for a TypeScript and return an array of the IDs

Online Restricted: The CRMScript agent is not available in Online by default. Access must be requested specifically when app is registered.
Declaration
Task<int[]> ResolveIncludesAsync(string script, bool ignoreErrors, CancellationToken cancellationToken = default)
Parameters
Type Name Description
string script

The script to resolve includes for

bool ignoreErrors

If true, then missing includes will be ignored

CancellationToken cancellationToken
Returns
Type Description
Task<int[]>

The ids of all the included scripts

SaveCRMScriptByUniqueIdentifierAsync(string, Script, CancellationToken)

Create or Update the CRMScript information

Online Restricted: The CRMScript agent is not available in Online by default. Access must be requested specifically when app is registered.
Declaration
Task<Script> SaveCRMScriptByUniqueIdentifierAsync(string uniqueIdentifier, Script crmscript, CancellationToken cancellationToken = default)
Parameters
Type Name Description
string uniqueIdentifier

Global unique reference to script (independent of installation)

Script crmscript

Information about the CRMScript

CancellationToken cancellationToken
Returns
Type Description
Task<Script>

Information about the CRMScript as saved in the database

SaveCRMScriptEntityAsync(CRMScriptEntity, CancellationToken)

Updates the existing CRMScriptEntity or creates a new CRMScriptEntity if the id parameter is empty

Online Restricted: The CRMScript agent is not available in Online by default. Access must be requested specifically when app is registered.
Declaration
Task<CRMScriptEntity> SaveCRMScriptEntityAsync(CRMScriptEntity cRMScriptEntity, CancellationToken cancellationToken = default)
Parameters
Type Name Description
CRMScriptEntity cRMScriptEntity

The CRMScriptEntity that is saved.

CancellationToken cancellationToken
Returns
Type Description
Task<CRMScriptEntity>

New or updated CRMScriptEntity

SaveCRMScriptEntityWithoutCompileAsync(CRMScriptEntity, CancellationToken)

Save the script directly without compiling TypeScript

Online Restricted: The CRMScript agent is not available in Online by default. Access must be requested specifically when app is registered.
Declaration
Task<CRMScriptEntity> SaveCRMScriptEntityWithoutCompileAsync(CRMScriptEntity crmScriptEntity, CancellationToken cancellationToken = default)
Parameters
Type Name Description
CRMScriptEntity crmScriptEntity

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

CancellationToken cancellationToken
Returns
Type Description
Task<CRMScriptEntity>

The saved entity

SaveTriggerScriptByUniqueIdAsync(string, TriggerScriptEntity, CancellationToken)

Validate a CRMScript. This will check that the syntax is correct

Online Restricted: The CRMScript agent is not available in Online by default. Access must be requested specifically when app is registered.
Declaration
Task<TriggerScriptEntity> SaveTriggerScriptByUniqueIdAsync(string triggerScriptUniqueId, TriggerScriptEntity entity, CancellationToken cancellationToken = default)
Parameters
Type Name Description
string triggerScriptUniqueId

The unique id of the CRMScript to validate

TriggerScriptEntity entity

Trigger script details and source code

CancellationToken cancellationToken
Returns
Type Description
Task<TriggerScriptEntity>

Trigger script details and source code.

SaveTriggerScriptEntityAsync(TriggerScriptEntity, CancellationToken)

Updates the existing TriggerScriptEntity or creates a new TriggerScriptEntity if the id parameter is empty

Online Restricted: The CRMScript agent is not available in Online by default. Access must be requested specifically when app is registered.
Declaration
Task<TriggerScriptEntity> SaveTriggerScriptEntityAsync(TriggerScriptEntity triggerScriptEntity, CancellationToken cancellationToken = default)
Parameters
Type Name Description
TriggerScriptEntity triggerScriptEntity

The TriggerScriptEntity that is saved.

CancellationToken cancellationToken
Returns
Type Description
Task<TriggerScriptEntity>

New or updated TriggerScriptEntity

ValidateScriptAsync(int, CancellationToken)

Validate a CRMScript. This will check that the syntax is correct

Online Restricted: The CRMScript agent is not available in Online by default. Access must be requested specifically when app is registered.
Declaration
Task<CRMScriptResult> ValidateScriptAsync(int cRMScriptId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int cRMScriptId

The id of the CRMScript to execute

CancellationToken cancellationToken
Returns
Type Description
Task<CRMScriptResult>

True if the syntax is correct

ValidateScriptByIncludeIdAsync(string, CancellationToken)

Validate a CRMScript. This will check that the syntax is correct

Online Restricted: The CRMScript agent is not available in Online by default. Access must be requested specifically when app is registered.
Declaration
Task<CRMScriptResult> ValidateScriptByIncludeIdAsync(string cRMScriptIncludeId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
string cRMScriptIncludeId

The include id of the CRMScript to validate

CancellationToken cancellationToken
Returns
Type Description
Task<CRMScriptResult>

True if the syntax is correct

ValidateScriptByStringAsync(string, CancellationToken)

Validate a CRMScript 2 (JavaScript). This will check that the syntax is correct

Online Restricted: The CRMScript agent is not available in Online by default. Access must be requested specifically when app is registered.
Declaration
Task<CRMScriptResult> ValidateScriptByStringAsync(string script, CancellationToken cancellationToken = default)
Parameters
Type Name Description
string script

The script to validate

CancellationToken cancellationToken
Returns
Type Description
Task<CRMScriptResult>

The result of the syntax check

ValidateScriptByUniqueIdAsync(string, CancellationToken)

Validate a CRMScript. This will check that the syntax is correct

Online Restricted: The CRMScript agent is not available in Online by default. Access must be requested specifically when app is registered.
Declaration
Task<CRMScriptResult> ValidateScriptByUniqueIdAsync(string cRMScriptUniqueId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
string cRMScriptUniqueId

The unique id of the CRMScript to validate

CancellationToken cancellationToken
Returns
Type Description
Task<CRMScriptResult>

True if the syntax is correct

ValidateTriggerScriptAsync(int, CancellationToken)

Validate a Trigger CRMScript. This will check that the syntax is correct, but not execute the script.

Online Restricted: The CRMScript agent is not available in Online by default. Access must be requested specifically when app is registered.
Declaration
Task<CRMScriptResult> ValidateTriggerScriptAsync(int triggerScriptId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int triggerScriptId

The id of the CRMScript Trigger to validate

CancellationToken cancellationToken
Returns
Type Description
Task<CRMScriptResult>

True if the syntax is correct

ValidateTriggerScriptByUniqueIdAsync(string, CancellationToken)

Validate a Trigger CRMScript. This will check that the syntax is correct, but not execute the script.

Online Restricted: The CRMScript agent is not available in Online by default. Access must be requested specifically when app is registered.
Declaration
Task<CRMScriptResult> ValidateTriggerScriptByUniqueIdAsync(string triggerScriptUniqueId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
string triggerScriptUniqueId

The unique id of the CRMScript to validate

CancellationToken cancellationToken
Returns
Type Description
Task<CRMScriptResult>

True if the syntax is correct

© SuperOffice. All rights reserved.
SuperOffice |  Community |  Release Notes |  Privacy |  Site feedback |  Search Docs |  About Docs |  Contribute |  Back to top