<a id=“SuperOffice_WebApi_Agents_CRMScriptAgent”></a> Class CRMScriptAgent
Namespace: SuperOffice.WebApi.AgentsAssembly: 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.
Inheritance
object ← AgentBase ← CRMScriptAgentImplements
ICRMScriptAgent, IAgentBase, IDisposableInherited Members
AgentBase._json, AgentBase._binary, AgentBase._config, AgentBase._client, AgentBase._disposeClient, AgentBase.Merge(RequestOptions), AgentBase.BuildRequestFromObject(HttpMethod, string, object, WebApiOptions, string), AgentBase.BuildRequestFromStream(HttpMethod, string, Stream, WebApiOptions, string), AgentBase.BuildRequestFromObjectWithStream(HttpMethod, string, object, Stream, WebApiOptions, string), AgentBase.ParseAuthorization(IAuthorization), AgentBase.CancelRequest(), AgentBase.SendRequestObject(HttpMethod, string, object, WebApiOptions, string), AgentBase.SendRequestObjectWithStream(HttpMethod, string, object, Stream, WebApiOptions, string), AgentBase.SendRequest(HttpRequestMessage, RequestOptions), AgentBase.ThrowOnResponseErrorAsync(HttpRequestMessage, HttpResponseMessage), AgentBase.ParseResponse<T>(HttpResponseMessage), AgentBase.Finally(RequestOptions), AgentBase.Dispose(), AgentBase.Configuration, AgentBase.Client, AgentBase.HasRunningRequest, AgentBase.ClientCancellationTokenSource, AgentBase.ProgressListener, AgentBase.UploadProgressListener, object.ToString(), object.Equals(object), object.Equals(object, object), object.ReferenceEquals(object, object), object.GetHashCode(), object.GetType(), object.MemberwiseClone()Examples
<pre><code class=“lang-csharp”>using SuperOffice.WebApi; using SuperOffice.WebApi.Agents; var mySession = new WebApiOptions(“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.Parameters
httpClient 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.Parameters
options WebApiOptions
Base URL and authentication values.
httpClient 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 instanceParameters
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<CRMScriptEntity> 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 instanceParameters
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<TriggerScriptEntity> 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.Parameters
uniqueIdentifier string
Global unique reference to script (independent of installation)
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
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.Parameters
cRMScriptEntityId int
The identity of the CRMScriptEntity
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
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.Parameters
triggerScriptUniqueId string
The unique id of the CRMScript to validate
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
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.Parameters
triggerScriptEntityId int
The identity of the TriggerScriptEntity
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
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.Parameters
cRMScriptId int
The id of the CRMScript to execute
eventData EventData
The EventData instance sent to the crmscript with input values
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<EventData> 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.Parameters
cRMScriptUniqueId string
The unique id of the CRMScript to execute
eventData EventData
The EventData instance sent to the crmscript with input values
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<EventData> 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.Parameters
cRMScriptId int
The id of the CRMScript to execute
parameters StringDictionary
Parameters passed as variables to the CRMScript
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<string> 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.Parameters
cRMScriptIncludeId string
The include id of the CRMScript to validate
parameters StringDictionary
Parameters passed as variables to the CRMScript
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<string> 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.Parameters
script string
The script to execute
parameters StringDictionary
Parameters passed as variables to the CRMScript
eventData EventData
The EventData instance sent to the crmscript with input values
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<CRMScriptRunResult> 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.Parameters
cRMScriptUniqueId string
The unique id of the CRMScript to validate
parameters StringDictionary
Parameters passed as variables to the CRMScript
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<string> 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.Parameters
uniqueIdentifier string
Global unique reference to script (independent of installation)
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<Script> 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.Parameters
cRMScriptEntityId int
The identifier of the CRMScriptEntity object
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<CRMScriptEntity> 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.Parameters
triggerScriptUniqueId string
The unique id of the CRMScript to validate
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<TriggerScriptEntity> 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.Parameters
triggerScriptEntityId int
The identifier of the TriggerScriptEntity object
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<TriggerScriptEntity> 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.Parameters
script string
The script to resolve includes for
ignoreErrors bool
If true, then missing includes will be ignored
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<int[]> 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.Parameters
uniqueIdentifier string
Global unique reference to script (independent of installation)
crmscript Script
Information about the CRMScript
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<Script> 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.Parameters
cRMScriptEntity CRMScriptEntity
The CRMScriptEntity that is saved.
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<CRMScriptEntity> 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.Parameters
crmScriptEntity CRMScriptEntity
The entity to save. Source and SourceCode should both be specified
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<CRMScriptEntity> 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.Parameters
triggerScriptUniqueId string
The unique id of the CRMScript to validate
entity TriggerScriptEntity
Trigger script details and source code
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<TriggerScriptEntity> 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.Parameters
triggerScriptEntity TriggerScriptEntity
The TriggerScriptEntity that is saved.
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<TriggerScriptEntity> 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.Parameters
cRMScriptId int
The id of the CRMScript to execute
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<CRMScriptResult> 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.Parameters
cRMScriptIncludeId string
The include id of the CRMScript to validate
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<CRMScriptResult> 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.Parameters
script string
The script to validate
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<CRMScriptResult> 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.Parameters
cRMScriptUniqueId string
The unique id of the CRMScript to validate
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<CRMScriptResult> 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.Parameters
triggerScriptId int
The id of the CRMScript Trigger to validate
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<CRMScriptResult> 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.Parameters
triggerScriptUniqueId string
The unique id of the CRMScript to validate
requestOptions RequestOptions
Override language/culture codes on this request.