The IC Script language is a VBA (Visual Basic for Applications) compatible scripting language. You can use the IC Script functions and methods to create custom IC Scripts that you can attach to application and database events in IC applications, Avaya Agent, and the Avaya Agent Web Client.
You can attach IC Scripts to application events to override or add to the default action, or to implement business rules. For more information about the IC Script language, see the IC Scripts Language Reference. For information about how to customize Avaya Agent, see Avaya Agent Integration. For information on how to customize the Avaya Agent Web Client, see Avaya Agent Web Client Customization.
You modify IC Scripts using the IC Script Editor in Database Designer. The IC Script Editor can locate IC Scripts within large files, verify script syntax, and maintain proper header information. IC applications use IC Scripts to:
● Constrain button or right-menu searches in non-standard ways
● Script a search to return all calls assigned to the user’s database login ID
● Fill in defaults automatically when creating a new record (depending on the application context)
● Notify interested parties when a record is updated (depending on the state of the record). This section contains the following topics:
● How to organize IC Scriptson page 179
● How to use IC Scripts in IC applicationson page 179
● Overview of the IC Script Editoron page 180
● How to manage IC Scriptson page 182
● How to edit an IC Scripton page 184
● How to create an IC Scripton page 185
● Overview of IC Script string table messageson page 186
● How to check the syntax of IC Scriptson page 190
How to organize IC Scripts
IC Scripts are stored in ASCII files that end with the QSC extension. Each file may contain one or more IC Scripts.
You can modify any of the standard IC Scripts. However, to create new IC Scripts or make major changes to existing ones, you should create a separate file. Many customers create a
custom.qsc file or use a naming convention relevant to their defined business-based behavior. If a new IC Script relates to the workflow of an IC Script contained in an existing QSC file, you can add the new IC Script to that file.
CAUTION:
!
CAUTION: Standard IC Script files may be overwritten when you upgrade to a new version,
deleting your modified IC Script. Therefore, if you add new IC Scripts to a
standard QSC file, save the file separately before upgrading your IC applications, then make the modifications to the new IC Script file. For details about migration, see IC/OA Software Upgrade and Data Migration.
How to use IC Scripts in IC applications
You can attach IC Scripts to an IC application in a variety of ways, including application interface objects, browsers, search buttons, and database events.
A typical implementation works as follows:
1. The IC application user selects a Search button in the interface. An IC Script associated with the Search button runs against the field values in the group. The field values are stored as search constraints.
2. An IC Script associated with the browser runs against the stored search constraints. 3. The resulting SQL is run against the table.
4. The browser area is filled with the results of the search. The user selects a record from the browser.
5. When the user selects the record from the browser, a Backfill event occurs which runs the IC Script associated with the group. For example, the IC Script could compute the value of a field based on data in two or more columns, such as call age.
6. The user selects the Update button. An IC Script associated with the button runs against the field values in the group.
8. The specified field values correspond with the IC Script. The SQL is computed and run against the table. The record is updated.
9. After the update, an IC Script runs against the table alias (for example, afterUpdate event).
Overview of the IC Script Editor
You create, view, and modify IC Scripts in the IC Script Editor in Database Designer. You can also use the IC Script Editor to check the syntax of an IC Script.
The IC Script Editor lets you place the cursor anywhere within your IC Script, including in "empty spaces." (Empty spaces are areas within the IC Script that do not contain text, such as a tab’s expanded space or the area beyond the last character on a line.)
CAUTION:
!
CAUTION: When copying and pasting text into the IC Script Editor, you cannot paste more
than 256 characters. If you exceed this maximum line length, the IC Script Editor truncates the text.
To open the IC Script Editor, select Edit > IC Scripts. The IC Script Editor window includes the following:
● IC Script pane. Top pane that displays the names, file locations, and other information about IC Scripts. The IC Script Editor points to an IC Script in a file.
● Edit pane. Bottom pane that contains the code for the IC Script selected in the IC Script pane.
● Split bar. A divider at the bottom of the Edit pane. Drag the split bar to view and edit a second IC Script.
How to search in an IC Script
You can use the IC Script Editor’s Find/Replace dialog box to search for and replace text strings in a selected IC Script.
To find a text string in a script:
1. In the IC Script Editor, select a script from the list.
2. Open the Find/Replace dialog box by selecting Edit > Find/Replace.
3. In the Find/Replace dialog box, enter the text string that you want to find in the Find String field:
● To find text with specific capitalization, type the text as it should be capitalized and select the Match Case option
● To find a whole string, type the string and select the Match Whole Word option. 4. Select the direction that you want to search in the IC Script. If you do not click inside the IC
Script, the search starts at the top of the IC Script. ● Select Up to search above the current insertion point ● Select Down to search below the current insertion point.
5. Select Find Next. The next occurrence of the string is highlighted in the IC Script. 6. To replace the selected text with another text string, type the replacement text in the
Replace With field and select Replace.
How to insert text
When you enter certain types of text in IC Script Editor, the text automatically appears in a distinctive color. The colors are:
● Keywords appear in blue ● Identifier text appears in black
● Comments (in lines beginning with an apostrophe) appear in green.
For more information, see How to break an IC Script statement across multiple lineson page 185.
Text selection
In IC Script Editor, you can select either a portion of one line or whole lines. You cannot select a portion of one line plus one or more lines. When you select multiple lines and part of a line, IC Script Editor automatically extends the selection to include the entire line.
Note:
Note: When you select an entire line, extend your selection far enough to include the
hidden end-of-line character that inserts a new line in your IC Script.
Keyboard shortcuts
You can use keyboard shortcuts to move the cursor within your IC Script. When you use a keyboard shortcut to move the cursor, the IC Script Editor scrolls the new cursor location into view if it is not already displayed.
In addition to the standard keyboard shortcuts, the IC Script Editor provides the following shortcuts:
Editing shortcuts
In addition to the standard keyboard shortcuts, the IC Script Editor provides the following shortcuts to help you perform editing operations:
How to manage IC Scripts
IC Scripts are stored locally. Avaya recommends that you edit IC Scripts on your local system, and save any changes to your local system. To test your changes in the application, load the QSC files on your local system to the database.
A QSC file can contain one or more IC Scripts. Avaya recommends that you create a QSC file for each functional area in your application. For example, you could create:
● calls.qsc for all IC Scripts associated with calls ● defects.qsc for all IC Scripts associated with defects
Key(s)… Function…
PgUp Moves the insertion point up by one window PgDn Moves the insertion point down by one window Ctrl+PgUp Scrolls the insertion point left by one window Ctrl+PgDn Scrolls the insertion point right by one window
Ctrl+Home Places the insertion point before the first character in the IC Script Ctrl+End Places the insertion point after the last character in the IC Script Ctrl+G Opens the Goto Line dialog box (cursor must be in Edit pane)
Key(s) Function
Ctrl+Y Deletes the entire line containing the insertion point without placing it on the Clipboard
Shift+any
navigating shortcut Selects the text between the initial location of the insertion point and the point to which the keyboard shortcut would normally move the insertion point. (For example, Shift+Ctrl+Left arrow selects the word to the left of the insertion point while Shift+Ctrl+Home
selects all the text from the location of the insertion point to the start of your IC Script.)
● person.qsc for all IC Scripts associated with records for employees or customers.
Note:
Note: IC Scripts have a size limitation of 65535 bytes. If your IC Script exceeds this
size, break it into two or more smaller IC Scripts.
IC Script components
Most IC Scripts contain the following components:
● Header. The header contains IC Script tracking information required by the IC Script Editor and the application. The header is not normally visible in the IC Script Editor, but can be seen in the ASCII IC Script file. Avaya recommends that you do not edit IC Scripts outside the IC Script Editor.
● Comments. Script lines containing information about the IC Script that begin with a single quote and are ignored by the application.
● Declarations. Declarations are made using standard VBA. Most declarations begin with the Dim statement.
● Business-based Logic. Business-based logic is the set of instructions made up of standard VBA and IC-specific extensions. These instructions may be a self-contained program or may include subroutines, subfunctions, or calls to external scripts or programs. ● Error Handling. Error handling tells the program what to do in the event of an error.
How to automatically load IC Script files
The IC Script Editor automatically loads any QSC files that are:
● Stored in the directories that are referenced in the ADL file that you are editing ● In the same directory as the ADL file you are editing.
Tip:
Tip: Avaya recommends that you save any application-specific QSC files to the same
directory as your application ADL file. If you create a QSC file that is not specific to an application, store the file in a separate directory.
To confirm whether a QSC file loaded automatically in the IC Script Editor, verify the path and name of the QSC file in the IC Script pane. If the path and name do not appear, the QSC file was not automatically loaded.
How to save IC Scripts
In the IC Script Editor, you can save changes to all of the loaded QSC files to your local system. To save the loaded QSC files to your local system, select File > Save.
If you are modifying an IC Script for an IC application, you must update the application
information to load the IC Scripts into the database (see How to update application information
in the databaseon page 220).
For information about uploading individual IC Scripts to the database, see Uploading IC
Scriptson page 191.
How to edit an IC Script
You can use the IC Script Editor to edit one or more IC Scripts. To edit an IC Script:
1. Select Edit > IC Scripts to open the IC Script Editor. 2. If desired, filter the IC Scripts that are displayed:
3. Select an IC Script from the IC Script pane. The IC Script Editor displays the file name, main entry for the IC Script, and location of the QSC file.
4. In the Edit pane, perform your edits.
5. When you finish, save your changes locally by selecting File > Save.
Note:
Note: IC Scripts have a size limitation of 65535 bytes. If your IC Script exceeds this
size, you need to break it into two or more smaller IC Scripts.
If you are modifying an IC application, you must update the application information to load the IC Scripts into the database (see How to update application information in the databaseon page 220).
To display… Select…
All IC Scripts All
IC Scripts attached to a form the Form option, then select the form that you want from the Form drop-down
IC Scripts attached to a table the Table option, then select a table alias from the
How to add comments to IC Scripts
You can add comments to an IC Script to remind yourself or others of how your code works and what the IC Script does. Comments are ignored when your IC Script is executed.
In an IC Script, an apostrophe (’) indicates that the text from the apostrophe to the end of the line is a comment.
You can add a comment at the end of a line of code. When the IC Script is run, the code in the first portion of the line is executed, but the comment text after the apostrophe is ignored.
Note:
Note: If you place executable code at the end of a line containing a comment, that code
will not be executed.
How to break an IC Script statement across multiple lines
In IC Script Editor, a single IC Script statement can extend only as far as the right margin. Each line break represents a new statement. However, you can override this default and break a long statement across multiple lines.
To break an IC Script statement across multiple lines:
1. Type the IC Script statement on multiple lines, exactly the way you want it to appear. 2. Place the insertion point at the end of the first line in the series.
3. Press the Spacebar once to insert a single space.
4. Type an underscore ( _ ). (The underscore is the line-continuation character. It indicates that the IC Script statement continues on the following line.)
5. Repeat steps 2 through 4 to place a line-continuation character at the end of each line in the series except the last.
When you run your IC Script, the code on this series of lines will be executed as a single IC Script statement, just as if you had typed the entire statement on the same line.
How to create an IC Script
You can create a new IC Script in an existing QSC file or in a new QSC file.
Note:
For more information about creating IC Scripts and the IC Script language, see the IC Scripts Language Reference.
To create an IC Script:
1. In the IC Script Editor, select New. 2. In the New Script dialog box:
a. Enter the name of the IC Script in the Name field.
b. Enter the path and file name of the QSC file where you are storing the IC Script in the
File Name field. To select an existing QSC file, select Browse and select a QSC file. c. Specify the name of the IC Script’s subroutine (the main point-of-entry) in the Entry
field.
d. In the Type field:
Note:
Note: IC Scripts that load on application startup can be global functions and can be
called by other procedures. 3. In the Edit pane, edit the IC Script.
4. Save your changes locally by selecting File > Save.
Overview of IC Script string table messages
String tables are used to store error and confirmation messages used by some out-of-the-box IC Scripts in order to simplify the process of translating IC Script messages for IC international releases. Database Designer stores IC Script string table messages, including error and confirmation messages, in one or more XML files with an ALM extension. Database Designer generates the ALM files when you save your ADL file.
Select… For IC Scripts that…
Application Are attached to the application components and are loaded the first time the application calls the IC Script. The IC Scripts that ship with the standard IC applications are of this type.
Builtin Are loaded on application startup and are called from within the application. These IC Scripts are not loaded by the servers. User Are loaded on application startup and are attached to the
application components. These IC Scripts are loaded by the servers.
The out-of-the-box IC Scripts that use IC Script messages from the string table include IC Scripts for Avaya Agent and Avaya Agent Web Client, and some IC Scripts that are common to all IC applications. In these out-of-the-box IC Scripts, the error handling code in the IC Script:
● Includes the arguments required by the string
● Points to a string code that represents the message text stored in the string table By default, the string table for each application is installed in the design folder for that application and called appname.alm.
When you select the Messages option and generate your application, Database Designer: ● Uploads the ALM files to the application database
● Creates the qw_message table in the application database ● Stores the string table messages in the qw_message table.
For more information, see How to generate application dataon page 221.
Guidelines for using string table messages
Use the following guidelines to determine whether you should use a string table message in your IC Script:
● Do not use the string table to store messages for custom IC Scripts. Retrieving the message text from the string table requires a database call and, therefore, can impact application performance.
● Do not change the message text for out-of-the-box IC Scripts. Most string table messages