What is automation?
Automation allows an application to execute code when an event occurs inside the client. These events occur when an action takes place such as when a dialog is opened, or a person is created.
While automation code is usually defined by customer requirements, consultants often create routines that assist with common tasks. Automation code can perform just about any task imaginable, but generally involve validating, transforming, and/or moving data. These types of routines are commonly discussed in the developer forums.
Internal automation APIs are very useful for managing predetermined routines based on customers' requirements and providing user interaction within the application. They can make complex multiple-step tasks easier by programmatically automating the mundane details letting the user focus on the task at hand.
A trigger, as defined in Settings and Maintenance, is either a CRMScript or a macro. However, scripts and macros don't have to be triggers. Confused? Let's look at the process in general terms first.
Event: the thing that happens
Trigger: condition or filter
Handler: response logic
In this flow, a trigger connects the event to the handler in an if-this-then-that kind of way. Unfortunately, the distinction between event and trigger, as well as between trigger and handler, gets blurry.
What we call a trigger in the user interface is the result of setting up both the condition and response to built-in UI events. You select the event first, then define the condition, and finally the action to take.
A macro is the user-friendly version of a CRMScript and comes with an easy-to-use wizard to set it up. You can connect it to a trigger (UI event). However, you can also assign a macro to buttons (such as Actions) in defined screens.
In addition, there are a few more options for Service:
Hook scripts: alternative to triggers and runs every time a particular screen in Service is loaded (beforeSetFromCgi, afterSetFromCgi, beforePrint)
Extra menu: triggers a script or macro from a Service menu option (or performs custom navigation)
Button script: assigned to a custom button in Service and runs when clicked (bLogic action = doScript)
Script language options by platform
There are several scripting options available for each platform. The table details which automation languages are supported by each platform.
|CRM Web (online)
|CRM Web (onsite)
C# and VB.NET are supported as .cs and .vb files, or as compiled assemblies, in a specified directory.
SuperOffice Service leverages its own scripting engine and language, known as CRMScript. Primarily used to automate workflows around customer service scenarios involving tickets, mailings, and templates. However, it has been extended to include classes and methods that mirror NetServer web service APIs.
CRM Web (onsite)
SuperOffice CRM is slightly more complicated than SuperOffice Service.
The onsite SuperOffice Web client relies exclusively on client-side JavasScript support. SuperOffice tests the Web client against all major browsers and versions to ensure a fully functional client no matter what the browser policy in an organization.
The onsite Web client also supports server-side scripting by executing C# or VB.NET scripts on the application server.
The Windows client has the most complete automation engine of all the SuperOffice products. It is, for example, the only client that out of the box exposes events that can invoke script routines when users open and close dialogs. This presents an opportunity to either eliminate or augment other integrations.
It hosts a scripting environment made possible by the MSScriptControl, a COM component that's built-in and made available on every Windows operating system.
It can load and execute both vbScript and JScript code. The scripting environment does enable some interaction with users by showing message boxes or displaying input boxes.
Automation code in the CRM Windows client has complete access to all of the current user's contextual identity values. The following code snippet demonstrates how to access the current company's current identity value:
contactId = CurrentContact.Identity
var contact = AjaxMethodDispatcher.CallSync(
"SuperOffice.DCF.Web.AjaxMethods.SuperState.GetCurrent", "", "contact"