Class CRMScriptAgent
Proxy class for the CRMScript Agent Used when communicating remote using WebServices. Avoid using directly. Use the AgentFactory to create the proxy instead.
Online Restricted: This agent is not available in Online by default. Access must be requested specifically when app is registered.Syntax
public class CRMScriptAgent : ICRMScriptAgent, IAgent
Constructors
CRMScriptAgent(IScriptImplementation, ICRMScriptEntityImplementation, ITriggerScriptEntityImplementation, ISoRequestItemsAccessor)
Proxy class for the CRMScript Agent Used when communicating remote using WebServices. Avoid using directly. Use the AgentFactory to create the proxy instead.
Online Restricted: This agent is not available in Online by default. Access must be requested specifically when app is registered.Declaration
public CRMScriptAgent(IScriptImplementation scriptImplementation, ICRMScriptEntityImplementation cRMScriptEntityImplementation, ITriggerScriptEntityImplementation triggerScriptEntityImplementation, ISoRequestItemsAccessor accessor)
Parameters
Type | Name | Description |
---|---|---|
IScriptImplementation | scriptImplementation | |
ICRMScriptEntityImplementation | cRMScriptEntityImplementation | |
ITriggerScriptEntityImplementation | triggerScriptEntityImplementation | |
ISoRequestItemsAccessor | accessor |
CRMScriptAgent(IScriptImplementation, ICRMScriptEntityImplementation, ITriggerScriptEntityImplementation, ISoRequestItemsAccessor, IDebugUser, IServiceCallsRepository)
Proxy class for the CRMScript Agent Used when communicating remote using WebServices. Avoid using directly. Use the AgentFactory to create the proxy instead.
Online Restricted: This agent is not available in Online by default. Access must be requested specifically when app is registered.Declaration
public CRMScriptAgent(IScriptImplementation scriptImplementation, ICRMScriptEntityImplementation cRMScriptEntityImplementation, ITriggerScriptEntityImplementation triggerScriptEntityImplementation, ISoRequestItemsAccessor accessor, IDebugUser debugUser, IServiceCallsRepository serviceCallsRepository)
Parameters
Type | Name | Description |
---|---|---|
IScriptImplementation | scriptImplementation | |
ICRMScriptEntityImplementation | cRMScriptEntityImplementation | |
ITriggerScriptEntityImplementation | triggerScriptEntityImplementation | |
ISoRequestItemsAccessor | accessor | |
IDebugUser | debugUser | |
IServiceCallsRepository | serviceCallsRepository |
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
Declaration
public 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
Declaration
public 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
Declaration
public Task DeleteCRMScriptByUniqueIdentifierAsync(string uniqueIdentifier, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | uniqueIdentifier | Global unique reference to script (independent of installation) |
CancellationToken | cancellationToken | This operation cannot be cancelled; the cancellationToken parameter is ignored |
Returns
Type | Description |
---|---|
Task | This method has no return value |
DeleteCRMScriptEntityAsync(int, CancellationToken)
Deletes the CRMScriptEntity
Declaration
public 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.
Declaration
public Task DeleteTriggerScriptByUniqueIdAsync(string triggerScriptUniqueId, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | triggerScriptUniqueId | The unique id of the CRMScript to validate |
CancellationToken | cancellationToken | This operation cannot be cancelled; the cancellationToken parameter is ignored |
Returns
Type | Description |
---|---|
Task | This method has no return value |
DeleteTriggerScriptEntityAsync(int, CancellationToken)
Deletes the TriggerScriptEntity
Declaration
public 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.
Declaration
public 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 | This operation cannot be cancelled; the cancellationToken parameter is ignored |
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.
Declaration
public 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 | This operation cannot be cancelled; the cancellationToken parameter is ignored |
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.
Declaration
public 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 | This operation cannot be cancelled; the cancellationToken parameter is ignored |
Returns
Type | Description |
---|---|
Task<string> | The output produced by the CRMScript |
ExecuteScriptByIncludeIdAsync(string, StringDictionary, CancellationToken)
Execute a CRMScript with parameters, returning printed output value.
Declaration
public 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 | This operation cannot be cancelled; the cancellationToken parameter is ignored |
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.
Declaration
public 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 | This operation cannot be cancelled; the cancellationToken parameter is ignored |
Returns
Type | Description |
---|---|
Task<CRMScriptRunResult> | The output produced by the CRMScript |
ExecuteScriptByUniqueIdAsync(string, StringDictionary, CancellationToken)
Execute a CRMScript with parameters, returning printed output value.
Declaration
public 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 | This operation cannot be cancelled; the cancellationToken parameter is ignored |
Returns
Type | Description |
---|---|
Task<string> | The output produced by the CRMScript |
GetCRMScriptByUniqueIdentifierAsync(string, CancellationToken)
Get information about a script from a unique identifier
Declaration
public Task<Script> GetCRMScriptByUniqueIdentifierAsync(string uniqueIdentifier, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | uniqueIdentifier | Global unique reference to script (independent of installation) |
CancellationToken | cancellationToken | This operation cannot be cancelled; the cancellationToken parameter is ignored |
Returns
Type | Description |
---|---|
Task<Script> | Information about CRMScript |
GetCRMScriptEntityAsync(int, CancellationToken)
Gets a CRMScriptEntity object.
Declaration
public 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.
Declaration
public Task<TriggerScriptEntity> GetTriggerScriptByUniqueIdAsync(string triggerScriptUniqueId, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | triggerScriptUniqueId | The unique id of the CRMScript to validate |
CancellationToken | cancellationToken | This operation cannot be cancelled; the cancellationToken parameter is ignored |
Returns
Type | Description |
---|---|
Task<TriggerScriptEntity> | Trigger script details and source code. |
GetTriggerScriptEntityAsync(int, CancellationToken)
Gets a TriggerScriptEntity object.
Declaration
public 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
Declaration
public 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 | This operation cannot be cancelled; the cancellationToken parameter is ignored |
Returns
Type | Description |
---|---|
Task<int[]> | The ids of all the included scripts |
SaveCRMScriptByUniqueIdentifierAsync(string, Script, CancellationToken)
Create or Update the CRMScript information
Declaration
public 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 | This operation cannot be cancelled; the cancellationToken parameter is ignored |
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
Declaration
public 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
Declaration
public 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 | This operation cannot be cancelled; the cancellationToken parameter is ignored |
Returns
Type | Description |
---|---|
Task<CRMScriptEntity> | The saved entity |
SaveTriggerScriptByUniqueIdAsync(string, TriggerScriptEntity, CancellationToken)
Validate a CRMScript. This will check that the syntax is correct
Declaration
public 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 | This operation cannot be cancelled; the cancellationToken parameter is ignored |
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
Declaration
public 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
Declaration
public Task<CRMScriptResult> ValidateScriptAsync(int cRMScriptId, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int | cRMScriptId | The id of the CRMScript to execute |
CancellationToken | cancellationToken | This operation cannot be cancelled; the cancellationToken parameter is ignored |
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
Declaration
public Task<CRMScriptResult> ValidateScriptByIncludeIdAsync(string cRMScriptIncludeId, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | cRMScriptIncludeId | The include id of the CRMScript to validate |
CancellationToken | cancellationToken | This operation cannot be cancelled; the cancellationToken parameter is ignored |
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
Declaration
public Task<CRMScriptResult> ValidateScriptByStringAsync(string script, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | script | The script to validate |
CancellationToken | cancellationToken | This operation cannot be cancelled; the cancellationToken parameter is ignored |
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
Declaration
public Task<CRMScriptResult> ValidateScriptByUniqueIdAsync(string cRMScriptUniqueId, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | cRMScriptUniqueId | The unique id of the CRMScript to validate |
CancellationToken | cancellationToken | This operation cannot be cancelled; the cancellationToken parameter is ignored |
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.
Declaration
public Task<CRMScriptResult> ValidateTriggerScriptAsync(int triggerScriptId, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int | triggerScriptId | The id of the CRMScript Trigger to validate |
CancellationToken | cancellationToken | This operation cannot be cancelled; the cancellationToken parameter is ignored |
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.
Declaration
public Task<CRMScriptResult> ValidateTriggerScriptByUniqueIdAsync(string triggerScriptUniqueId, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | triggerScriptUniqueId | The unique id of the CRMScript to validate |
CancellationToken | cancellationToken | This operation cannot be cancelled; the cancellationToken parameter is ignored |
Returns
Type | Description |
---|---|
Task<CRMScriptResult> | True if the syntax is correct |