Class Void
Global functions
Syntax
Methods
addAction(String,String,Bool)
Adds an action to the Screen definition associated with this script (when the script is the load script for a Screen). An action is essentially a connection between a button with a given name and a script. When a button in the screen is pressed, the list of actions is checked, and the action with the matching button name (e.g. "ok", "cancel", "addSomething") will be found and the script will be executed.
Declaration
Void addAction(String button, String script, Bool doCheck)
Parameters
Type | Name | Description |
---|---|---|
String | button | The name of the associated button, such as OK. |
String | script | The script code to execute for this action. |
Bool | doCheck | If True, the contents of all input elements will be checked for validity before the action is executed. |
Returns
Type | Description |
---|---|
Void |
Remarks
Normally, doCheck should be True for buttons that submit the form, and False for buttons that add lines to grids, and so on.
addChatMessage(Integer,String,Integer,String,Integer,String)
Adds a message to a chat session.
Declaration
Integer addChatMessage(Integer sessionId, String message, Integer type, String author, Integer specialType, String specialParams)
Parameters
Type | Name | Description |
---|---|---|
Integer | sessionId | The ID of the chat session. |
String | message | The text of the message you want to add in HTML format. A few tags, such as <b>, <i>, <ul> are allowed. Other tags and attributes will be removed. |
Integer | type | 1 to indicate the message is to the customer." |
String | author | The string used as the author of the message. Placed above the message bubble. |
Integer | specialType | Mostly internally used. 0 = no special type; 16the message is from a chatbot |
String | specialParams | Various params based on the specialType. Specifically, for specialType=16, you can add showAt=<datetime> to specify when the message should show up to create a delay before the bot message is shown. |
Returns
Type | Description |
---|---|
Integer |
Remarks
You can optionally pass a DateTime
to set when the message will show up.
addChatMessage(Integer,String,Integer,String,Integer,String,DateTime)
Adds a message to a chat session and sets when the message will show up.
Declaration
Integer addChatMessage(Integer sessionId, String message, Integer type, String author, Integer specialType, String specialParams, DateTime whenPosted)
Parameters
Type | Name | Description |
---|---|---|
Integer | sessionId | The ID of the chat session. |
String | message | The text of the message you want to add in HTML format. A few tags, such as <b>, <i>, <ul> are allowed. Other tags and attributes will be removed. |
Integer | type | 1 to indicate the message is to the customer." |
String | author | The string used as the author of the message. Placed above the message bubble. |
Integer | specialType | Mostly internally used. 0 = no special type; 16 = the message is from a chatbot |
String | specialParams | Various params based on the specialType. Specifically, for specialType=16, you can add showAt=<datetime> to specify when the message should show up to create a delay before the bot message is shown. |
DateTime | whenPosted | If not null, this is when the message will show up in the clients and also the sorting field for messages. |
Returns
Type | Description |
---|---|
Integer |
Remarks
This variant of addChatMessage() is especially used for ChatBot-integrations.
addHtmlElement(Integer,String,Integer,Map)
Adds an HTML element to the associated screen when this script is executed as the load script for a screen.
Declaration
HtmlElement addHtmlElement(Integer id, String name, Integer type, Map config)
Parameters
Type | Name | Description |
---|---|---|
Integer | id | The ID of this HTML element. Normally not relevant. |
String | name | The unique name of this HTML element. Used for accessing it later. |
Integer | type | The type of this element. Types are documented under bLogic. |
Map | config | The map containing the configuration for the HTML element. |
Returns
Type | Description |
---|---|
HtmlElement | The element that was added. |
Remarks
You can optionally provide the zero-based position of the element in the list of elements for the screen.
addHtmlElement(Integer,String,Integer,Map,Integer)
Adds an HTML element to the associated screen with a zero-based position when this script is executed as the load script for a screen.
Declaration
HtmlElement addHtmlElement(Integer id, String name, Integer type, Map config, Integer position)
Parameters
Type | Name | Description |
---|---|---|
Integer | id | The ID of this HTML element. Normally not relevant. |
String | name | The unique name of this HTML element. Used for accessing it later. |
Integer | type | The type of this element. Types are documented under bLogic. |
Map | config | The map containing the configuration for the HTML element. |
Integer | position | The zero-based position of the element in the list of elements for the screen. |
Returns
Type | Description |
---|---|
HtmlElement | The element that was added. |
addHtmlElement(Integer,String,Integer,String)
Adds an HTML element to the associated screen when this script is executed as the load script for a screen.
Declaration
HtmlElement addHtmlElement(Integer id, String name, Integer type, String config)
Parameters
Type | Name | Description |
---|---|---|
Integer | id | The ID of this HTML element. Normally not relevant. |
String | name | The unique name of this HTML element. Used for accessing it later. |
Integer | type | The type of this element. Types are documented under bLogic. |
String | config | The configuration string for the HTML element. Line-based, same as configuration text for elements in Screen definition. |
Returns
Type | Description |
---|---|
HtmlElement | The element that was added. |
Remarks
You can optionally provide the zero-based position of the element in the list of elements for the screen.
addHtmlElement(Integer,String,Integer,String,Integer)
Adds an HTML element to the associated screen with a zero-based position when this script is executed as the load script for a screen.
Declaration
HtmlElement addHtmlElement(Integer id, String name, Integer type, String config, Integer position)
Parameters
Type | Name | Description |
---|---|---|
Integer | id | The ID of this HTML element. Normally not relevant. |
String | name | The unique name of this HTML element. Used for accessing it later. |
Integer | type | The type of this element. Types are documented under bLogic. |
String | config | The configuration string for the HTML element. Line-based, same as configuration text for elements in Screen definition. |
Integer | position | The zero-based position of the element in the list of elements for the screen. |
Returns
Type | Description |
---|---|
HtmlElement | The element that was added. |
assert(Bool)
Throws an AssertException if condition is false. The exception contains the line number where the assert occurred.
Declaration
Void assert(Bool condition)
Parameters
Type | Name | Description |
---|---|---|
Bool | condition |
Returns
Type | Description |
---|---|
Void |
Remarks
Used primarily with unit testing.
assertEquals(Bool,Bool)
Throws an AssertException if the two parameters are not equal. Specifically: if bool1!=bool2. The exception contains the line number where the assert occurred.
Declaration
Void assertEquals(Bool bool1, Bool bool2)
Parameters
Type | Name | Description |
---|---|---|
Bool | bool1 | The first value to test |
Bool | bool2 | The second value to test. |
Returns
Type | Description |
---|---|
Void |
Remarks
Used primarily with unit testing.
assertEquals(Float,Float)
Throws an AssertException if the two parameters are not equal. Specifically: if float1!=float2. The exception contains the line number where the assert occurred.
Declaration
Void assertEquals(Float float1, Float float2)
Parameters
Type | Name | Description |
---|---|---|
Float | float1 | The first value to test |
Float | float2 | The second value to test. |
Returns
Type | Description |
---|---|
Void |
Remarks
Used primarily with unit testing.
assertEquals(Integer,Integer)
Throws an AssertException if the two parameters are not equal. Specifically: if integer1!=integer2. The exception contains the line number where the assert occurred.
Declaration
Void assertEquals(Integer integer1, Integer integer2)
Parameters
Type | Name | Description |
---|---|---|
Integer | integer1 | The first value to test |
Integer | integer2 | The second value to test. |
Returns
Type | Description |
---|---|
Void |
Remarks
Used primarily with unit testing.
assertEquals(String,String)
Throws an AssertException if the two parameters are not equal. Specifically: if string1!=string2. The exception contains the line number where the assert occurred.
Declaration
Void assertEquals(String string1, String string2)
Parameters
Type | Name | Description |
---|---|---|
String | string1 | The first value to test |
String | string2 | The second value to test. |
Returns
Type | Description |
---|---|
Void |
Remarks
Used primarily with unit testing.
authenticateCustomer(String,String)
Checks a customer's username and password. Returns personId if successful, otherwise a null Integer.
Declaration
Integer authenticateCustomer(String username, String password)
Parameters
Type | Name | Description |
---|---|---|
String | username | The username of the customer. |
String | password | The password of the customer. |
Returns
Type | Description |
---|---|
Integer | The personId of the found customer. A null-Integer if the username was not found, or the password was incorrect. |
buildUrl()
Returns all POST and GET variables for the current URL.
Declaration
String buildUrl()
Returns
Type | Description |
---|---|
String | All POST and GET variables for the current URL. |
cgiWasPost()
Checks if the CGI HTTP request was of type POST.
Declaration
Bool cgiWasPost()
Returns
Type | Description |
---|---|
Bool | True if the CGI HTTP request was of type POST (not GET or anything else). |
Remarks
Service uses only GET and POST. POST is used when submitting most forms, a GET request is usually someone clicking a link, first time entering the bLogic screen.
checkReply(String)
Checks if it is ok to send a receipt to the indicated email address.
Declaration
Bool checkReply(String email)
Parameters
Type | Name | Description |
---|---|---|
String | Address to check. |
Returns
Type | Description |
---|---|
Bool | True if it is ok to send a receipt to the indicated email address; otherwise, false. |
Remarks
Every time this method is called, it records that an email has been sent to the email address. If this is done too often within a specified time interval (specified in config table), you should not send an email to the email address to prevent swamping.
combineHtmlStrings(Vector)
Takes several strings, each containing an HTML document, and combines them into one HTML string.
Declaration
String combineHtmlStrings(Vector htmlStrings)
Parameters
Type | Name | Description |
---|---|---|
Vector | htmlStrings | Multiple strings, each containing an HTML document. |
Returns
Type | Description |
---|---|
String | HTML string. |
Remarks
The head contents in each string is combined into the head tag of the output string, except for the title tag. The title tag is taken from the first string in the vector.
The body content is likewise combined into the body tag of the output string. All strings except for the first will have their body tags converted to div tags.convertGenericToString(Generic)
Returns the string representation of a variable. The argument is automatically be up-casted to a Generic.
Declaration
String convertGenericToString(Generic variable)
Parameters
Type | Name | Description |
---|---|---|
Generic | variable | The variable to convert. |
Returns
Type | Description |
---|---|
String | The string representation of the value in the Generic. |
Remarks
Not all types have implemented support for this, and might return "[complex]". All the basic types (String, Integer, Float, and so on) will return a correct string representation of their value.
Examples
Integer age = 42;
String s = convertGenericToString(age);
printLine(s);
convertStatus(Integer)
Converts a status given by its integer identifier to its string representation.
Declaration
String convertStatus(Integer status)
Parameters
Type | Name | Description |
---|---|---|
Integer | status | The status to convert. |
Returns
Type | Description |
---|---|
String | The status as a string. |
Remarks
The method is language-dependent.
copyCRMDocumentToAttachment(Integer)
Copies the content of a CRM Document, given the ID, to a new Service attachment.
Declaration
Integer copyCRMDocumentToAttachment(Integer crmDocId)
Parameters
Type | Name | Description |
---|---|---|
Integer | crmDocId | The ID of the CRM Document to copy. |
Returns
Type | Description |
---|---|
Integer | The ID of the newly created Service attachment. |
Remarks
There is no sync between these two, so only a copy at the point of time is made.
debugWait(String)
Pauses the script if it is in debug mode (see enableDebug). Stores the info string in the database entry for the current debug session so that it can be viewed in the debugger.
Declaration
Void debugWait(String info)
Parameters
Type | Name | Description |
---|---|---|
String | info | String to display in the debugger. |
Returns
Type | Description |
---|---|
Void |
decodeBase64(String)
Decodes a base64-encoded string into a byte array.
Declaration
Byte[] decodeBase64(String base64)
Parameters
Type | Name | Description |
---|---|---|
String | base64 | A base64 encoded string. |
Returns
Type | Description |
---|---|
Byte[] | Decoded byte array. |
decodeBase64AsStream(String)
Decodes a base64-encoded string into an NSStream.
Declaration
NSStream decodeBase64AsStream(String base64)
Parameters
Type | Name | Description |
---|---|---|
String | base64 | A base64-encoded string. |
Returns
Type | Description |
---|---|
NSStream |
decodeDBValue(String)
Decodes the value returned by for example NetServer archives, i.e [I:23], and returns the value as a string.
Declaration
String decodeDBValue(String dbValue)
Parameters
Type | Name | Description |
---|---|---|
String | dbValue | The value, including the prefix, that is returned by NetServer archives. |
Returns
Type | Description |
---|---|
String |
Remarks
You must convert it into the preferred type if used as anything else than a string.
enableDebug(String)
Enables debugging for the current script, with the given ID. If the executing environment contains the same debugId, then this script will enter debug mode.
Declaration
Void enableDebug(String debugId)
Parameters
Type | Name | Description |
---|---|---|
String | debugId | A string that will be compared with the debugId in the executing environment. |
Returns
Type | Description |
---|---|
Void |
Remarks
To set the debugId in a browser, use the "?action=debug" parameter. It is possible to debug a script, while it will continue to run as normal for other users.
encodeBase32(Byte[])
Encodes bytes to a base32 string.
Declaration
String encodeBase32(Byte[] data)
Parameters
Type | Name | Description |
---|---|---|
Byte[] | data | Data to encode. |
Returns
Type | Description |
---|---|
String | A base32-encoded string. |
encodeBase64(Byte[])
Encodes bytes to a base64 string.
Declaration
String encodeBase64(Byte[] data)
Parameters
Type | Name | Description |
---|---|---|
Byte[] | data | Data to encode. |
Returns
Type | Description |
---|---|
String | A base64-encoded string. |
Remarks
You can optionally pass a Bool to control if the encoded data should be wrapped with new lines or not.
encodeBase64(Byte[],Bool)
Encodes bytes to a base64 string specifying if the encoded data should be wrapped with new lines or not.
Declaration
String encodeBase64(Byte[] data, bool wrapLines)
Parameters
Type | Name | Description |
---|---|---|
Byte[] | data | Data to encode |
Bool | wrapLines | Controls if the encoded data should be wrapped with new lines. |
Returns
Type | Description |
---|---|
String | A base64-encoded string. |
encodeBase64(NSStream)
Encodes bytes to a base64 string.
Declaration
String encodeBase64(NSStream data)
Parameters
Type | Name | Description |
---|---|---|
NSStream | data | Data to encode. |
Returns
Type | Description |
---|---|
String | A base64-encoded string. |
Remarks
You can optionally pass a Bool to control if the encoded data should be wrapped with new lines or not.
encodeBase64(NSStream,Bool)
Encodes bytes to a base64 string specifying if the encoded data should be wrapped with new lines or not.
Declaration
String encodeBase64(NSStream data, bool wrapLines)
Parameters
Type | Name | Description |
---|---|---|
NSStream | data | Data to encode |
Bool | wrapLines | Controls if the encoded data should be wrapped with new lines. |
Returns
Type | Description |
---|---|
String | A base64-encoded string. |
encodeHMACSHA1(Byte[],Byte[])
Generates and returns a hash from a specified key-value pair using the HMAC SHA1 encoding algorithm.
Declaration
Byte[] encodeHMACSHA1(Byte[] key, Byte[] value)
Parameters
Type | Name | Description |
---|---|---|
Byte[] | key | The key used to create the hash. |
Byte[] | value | The value to be hashed. |
Returns
Type | Description |
---|---|
Byte[] | The generated hash. |
Remarks
This can be used to ensure data integrity. The hash cannot be decrypted back.
encodeHMACSHA1(String,String)
Generates and returns a hash from a specified key-value pair using the HMAC SHA1 encoding algorithm.
Declaration
String encodeHMACSHA1(String key, String value)
Parameters
Type | Name | Description |
---|---|---|
String | key | The key used to creating the hash |
String | value | The value to be hashed. |
Returns
Type | Description |
---|---|
String | The generated hash (formatted as hex). |
Remarks
This can be used to ensure data integrity. The hash cannot be decrypted back.
encodeHMACSHA256(String,String)
Generates and returns a hash from a specified key-value pair using the HMAC SHA256 encoding algorithm.
Declaration
Byte[] encodeHMACSHA256(String key, String value)
Parameters
Type | Name | Description |
---|---|---|
String | key | The key used to creating the hash |
String | value | The value to be hashed. |
Returns
Type | Description |
---|---|
Byte[] | The generated hash. |
Remarks
This can be used to ensure data integrity. The hash cannot be decrypted back.
encodeHMACSHA512(String,String)
Generates and returns a hash from a specified key-value pair using the HMAC SHA512 encoding algorithm.
Declaration
Byte[] encodeHMACSHA512(String key, String value)
Parameters
Type | Name | Description |
---|---|---|
String | key | The key used to creating the hash |
String | value | The value to be hashed. |
Returns
Type | Description |
---|---|
Byte[] | The generated hash. |
Remarks
This can be used to ensure data integrity. The hash cannot be decrypted back.
encodeSHA1(String)
Generates and returns a hash from a specified value using the SHA1 encoding algorithm.
Declaration
String encodeSHA1(String value)
Parameters
Type | Name | Description |
---|---|---|
String | value | The value to be hashed. |
Returns
Type | Description |
---|---|
String | The generated hash (formatted as hex). |
Remarks
This can be used to ensure data integrity. The hash cannot be decrypted back.
Examples
String s = "Hello world!";
printLine(encodeSHA1("Hello there!")); // Prints "6b19cb3790b6da8f7c34b4d8895d78a56d078624"
printLine(encodeSHA1("Hello world!")); // Prints "d3486ae9136e7856bc42212385ea797094475802"
printLine(encodeSHA1(s)); // Prints "d3486ae9136e7856bc42212385ea797094475802"
encodeSHA256(String,String)
Generates and returns a hash from a specified key-value pair using the SHA256 encoding algorithm.
Declaration
String encodeSHA256(String key, String value)
Parameters
Type | Name | Description |
---|---|---|
String | key | The key used to creating the hash |
String | value | The value to be hashed. |
Returns
Type | Description |
---|---|
String | The generated hash. The same key-value pair always returns the same hash (formatted as hex). |
Remarks
This can be used to ensure data integrity. The hash cannot be decrypted back.
Examples
String s = "Hello world!";
printLine(encodeSHA256("test", "Hello there!")); // Prints "39bf407008986fa79eac9cb0b3c8da3fb46acdd6f71721e38e6c4bbf1d14c222"
printLine(encodeSHA256("test", "Hello world!")); // Prints "1700f488c1e47cf1a8e8337c0a51d176291a5b4a200fe9bab866765a86edc0a4"
printLine(encodeSHA256("test", s)); // Prints "1700f488c1e47cf1a8e8337c0a51d176291a5b4a200fe9bab866765a86edc0a4"
executeDbiAgentSchedule(Integer,Map)
Manually starts a DBI agent schedule. It is possible to supply a map of parameter values used by the schedule.
Declaration
Void executeDbiAgentSchedule(Integer scheduleId, Map values)
Parameters
Type | Name | Description |
---|---|---|
Integer | scheduleId | The ID of the schedule to run |
Map | values | Name-value pairs with parameters. |
Returns
Type | Description |
---|---|
Void |
executeMacro(String)
The outermost function for executing a macro.
Declaration
String executeMacro(String parameters)
Parameters
Type | Name | Description |
---|---|---|
String | parameters | Input parameters. |
Returns
Type | Description |
---|---|
String |
executeSQLQuery(String)
Executes the specified SQL statement. This function is not available in CRM Online!
Declaration
Void executeSQLQuery(String sql)
Parameters
Type | Name | Description |
---|---|---|
String | sql | SQL statement to run. |
Returns
Type | Description |
---|---|
Void | Does not return anything! |
Remarks
In case of an error in the SQL statement, an exception will be thrown.
executeScript(String,Map)
Global functions
Declaration
String executeScript(String script, Map values)
Parameters
Type | Name | Description |
---|---|---|
String | script | Actual CRMScript code to execute |
Map | values |
Returns
Type | Description |
---|---|
String |
Remarks
Function to execute CRMScript code supplied.
exitWithMessage(String)
Exits running the rest of the script and displays a message with text from the parameter.
Declaration
Void exitWithMessage(String message)
Parameters
Type | Name | Description |
---|---|---|
String | message | The message to display. |
Returns
Type | Description |
---|---|
Void |
Remarks
Useful for exiting a script when for example detecting that the current user doesn't have access to a ticket.
faqSearch(Integer,Integer,String,Parser,Integer)
Searches FAQ using the same search engine as the customer pages do and fills the parser with the result.
Declaration
Parser faqSearch(Integer root, Integer access, String message, Parser p, Integer max)
Parameters
Type | Name | Description |
---|---|---|
Integer | root | The ID of the category folder where you want to search from. -1 for the whole tree |
Integer | access | The minimum access one needs for this search. AccessPrivate = 1; AccessInternal = 2; AccessRegisteredCustomers = 3; AccessPublic = 4 |
String | message | The words to search for. It will search for words containing one or more of these. Better hits gets a better score |
Parser | CRMScript_Global_Void_faqSearch_Integer_Integer_String_Parser_Integer_ | A parser with a script for checking further access. Use an empty parser if you do not want this. The script is in the same format as used in the GUI. |
Integer | max | The max number of hits. |
Returns
Type | Description |
---|---|
Remarks
Available parser variables (sorted, where the top most is the best hit):
Category parser array
- faq.categoryId - the id of the matching category
- faq.categoryName - the name of the matching category
- faq.categoryLink - a URL to the customer pages to the matching category
- faq.categoryDescription - the description of the matching category
- faq.categoryScore - the score of the matching category, given in percentage with 2 decimals precision
Entry parser array
- faq.entryId - the ID of the matching entry
- faq.entryName - the name of the matching entry
- faq.entryLink - a URL to the customer pages to the matching entry
- faq.entryQuestion - the question part of the matching entry
- faq.entryScore - the score of the matching entry, given in percentage with 2 decimals precision
findReplyTemplateToMerge(Integer)
If you have configured any categories to use specified ReplyTemplates, use this method to calculate the ReplyTemplate ID.
Declaration
Integer findReplyTemplateToMerge(Integer categoryId)
Parameters
Type | Name | Description |
---|---|---|
Integer | categoryId | The category ID to locate the reply template for. |
Returns
Type | Description |
---|---|
Integer | The ID of the reply template to use. |
flushCaches()
Flushes the caches in NetServer.
Declaration
Void flushCaches()
Returns
Type | Description |
---|---|
Void |
forceSaveTrace(Bool)
If there is a script trace enabled for the current script, with the exception-only flag set, calling this method with true as the parameter will make the trace become saved, just like if there was an unhandled exception.
Declaration
Void forceSaveTrace(Bool)
Parameters
Type | Name | Description |
---|---|---|
Bool | doSave | Whether to save or not |
Returns
Type | Description |
---|---|
Void |
Examples
forceSaveTrace(true);
Will save the trace if the other conditions are met.
forwardMail(String,String,Integer)
Forwards preformatted email.
Declaration
Void forwardMail(String mail, String to, Integer ticketId)
Parameters
Type | Name | Description |
---|---|---|
String | Pre-formatted mail |
|
String | to | Pre-formatted mail |
Integer | ticketId | Tag. |
Returns
Type | Description |
---|---|
Void |
GenericToArray(Generic)
Converts a Generic variable to an array of Generic (explicit downcast). Typically, this function is used when traversing the members of a struct, and one of the members is an array. This can be tested with getTypeDimensions(), and then GenericToArray() can be used to access the sub-elements of the array for further (recursive) processing.
Declaration
Generic[] GenericToArray(Generic value)
Parameters
Type | Name | Description |
---|---|---|
Generic | value | The variable to downcast. |
Returns
Type | Description |
---|---|
Generic[] | The variable as an array. |
Remarks
If the generic does not represent an array, an exception is thrown.
GenericToBool(Generic)
Converts a Generic variable to a Bool (explicit downcast). Together with getTypeName(), this function can be used to get an explicit typed variable.
Declaration
Bool GenericToBool(Generic value)
Parameters
Type | Name | Description |
---|---|---|
Generic | value | The variable to downcast. |
Returns
Type | Description |
---|---|
Bool | The variable as a Bool. |
Remarks
If the generic doesn't represent the correct type, an exception is thrown.
GenericToByte(Generic)
Converts a Generic variable to a Byte (explicit downcast). Together with getTypeName(), this function can be used to get an explicit typed variable.
Declaration
Byte GenericToByte(Generic value)
Parameters
Type | Name | Description |
---|---|---|
Generic | value | The variable to downcast. |
Returns
Type | Description |
---|---|
Byte | The variable as a Byte. |
Remarks
If the generic doesn't represent the correct type, an exception is thrown.
GenericToDate(Generic)
Converts a Generic variable to a Date (explicit downcast). Together with getTypeName(), this function can be used to get an explicit typed variable.
Declaration
Date GenericToDate(Generic value)
Parameters
Type | Name | Description |
---|---|---|
Generic | value | The variable to downcast. |
Returns
Type | Description |
---|---|
Date | The variable as a Date. |
Remarks
If the generic does not represent the correct type, an exception is thrown.
GenericToDateTime(Generic)
Converts a Generic variable to a DateTime (explicit downcast). Together with getTypeName(), this function can be used to get an explicit typed variable.
Declaration
DateTime GenericToDateTime(Generic value)
Parameters
Type | Name | Description |
---|---|---|
Generic | value | The variable to downcast. |
Returns
Type | Description |
---|---|
DateTime | The variable as a DateTime. |
Remarks
If the generic does not represent the correct type, an exception is thrown.
GenericToFloat(Generic)
Converts a Generic variable to a Float. Together with getTypeName(), this function can be used to get an explicit typed variable.
Declaration
Float GenericToFloat(Generic value)
Parameters
Type | Name | Description |
---|---|---|
Generic | value | The variable to downcast. |
Returns
Type | Description |
---|---|
Float | The variable as a Float. |
Remarks
If the generic does not represent the correct type, an exception is thrown.
GenericToInteger(Generic)
Converts a Generic variable to a Integer (explicit downcast). Together with getTypeName(), this function can be used to get an explicit typed variable.
Declaration
Integer GenericToInteger(Generic value)
Parameters
Type | Name | Description |
---|---|---|
Generic | value | The variable to downcast. |
Returns
Type | Description |
---|---|
Integer | The variable as an Integer. |
Remarks
If the generic does not represent the correct type, an exception is thrown.
GenericToString(Generic)
Converts a Generic variable to a String (explicit downcast). Together with getTypeName(), this function can be used to get an explicit typed variable.
Declaration
String GenericToString(Generic value)
Parameters
Type | Name | Description |
---|---|---|
Generic | value | The variable to downcast. |
Returns
Type | Description |
---|---|
String | The variable as a String. |
Remarks
If the generic does not represent the correct type, an exception is thrown.
GenericToTime(Generic)
Converts a Generic variable to a Time (explicit downcast). Together with getTypeName(), this function can be used to get an explicit typed variable.
Declaration
Time GenericToTime(Generic value)
Parameters
Type | Name | Description |
---|---|---|
Generic | value | The variable to downcast. |
Returns
Type | Description |
---|---|
Time | The variable as a Time. |
Remarks
If the generic does not represent the correct type, an exception is thrown.
GenericToTimeSpan(Generic)
Converts a Generic variable to a TimeSpan (explicit downcast). Together with getTypeName(), this function can be used to get an explicit typed variable.
Declaration
TimeSpan GenericToTimeSpan(Generic value)
Parameters
Type | Name | Description |
---|---|---|
Generic | value | The variable to downcast. |
Returns
Type | Description |
---|---|
The variable as a TimeSpan. |
Remarks
If the generic does not represent the correct type, an exception is thrown.
getActiveUser()
Returns a reference to the active user instance.
Declaration
User getActiveUser()
Returns
Type | Description |
---|---|
A reference to the active user instance. |
getAgentId(String)
Returns the ID of the agent matching the parameter.
Declaration
Integer getAgentId(String idString)
Parameters
Type | Name | Description |
---|---|---|
String | idString | The ID string of the agent. |
Returns
Type | Description |
---|---|
Integer | The ID of the agent matching the parameter; null if no match found. |
getAgentScheduleId(String)
Returns the ID of the agent schedule with the given name.
Declaration
Integer getAgentScheduleId(String name)
Parameters
Type | Name | Description |
---|---|---|
String | name | Name of the agent schedule. |
Returns
Type | Description |
---|---|
Integer | The ID of the agent schedule with the given name; -1 if no agent schedule was found. |
getAttachmentsSize(Integer[])
Gets the total byte size of the specified attachments.
Declaration
Integer getAttachmentsSize(Integer[] attachmentIds)
Parameters
Type | Name | Description |
---|---|---|
Integer[] | attachmentIds | An array of IDs to the attachment you want to compute the size for. |
Returns
Type | Description |
---|---|
Integer | The total size of the specified attachments. |
getCategoryIdFromFullname(String)
Finds category ID from the category's full name.
Declaration
Integer getCategoryIdFromFullname(String name)
Parameters
Type | Name | Description |
---|---|---|
String | name | Full name of category. |
Returns
Type | Description |
---|---|
Integer | ID of category. |
getCgiContent()
Returns the raw content of the HTTP request.
Declaration
String getCgiContent()
Returns
Type | Description |
---|---|
String | The raw content of the HTTP request. |
getCgiUrl()
Returns the cgiUrl value from the config table. For example, http://ejournal.company.com
Declaration
String getCgiUrl()
Returns
Type | Description |
---|---|
String | The string stored as the cgiUrl. |
Remarks
Used for creating URLs.
getCgiVariable(String)
Returns the CGI variable with the given name.
Declaration
String getCgiVariable(String varName)
Parameters
Type | Name | Description |
---|---|---|
String | varName | The name of the CGI variable to return. |
Returns
Type | Description |
---|---|
String | The CGI variable with the given name. |
getCgiVariableArray(String)
Returns a string array of all CGI variables matching the given name
Declaration
String[] getCgiVariableArray(String name)
Parameters
Type | Name | Description |
---|---|---|
String | name | Of the CGI variables to match. |
Returns
Type | Description |
---|---|
String[] | All CGI variables matching the given name. |
getCgiVariables()
Returns a map of all CGI variables.
Declaration
Map getCgiVariables()
Returns
Type | Description |
---|---|
Map | Map containing all CGI variables. |
getCookie(String)
Returns the CGI cookie with the given name. This method is not available in CRM Online.
Declaration
String getCookie(String name)
Parameters
Type | Name | Description |
---|---|---|
String | name | The name of the cookie to return. |
Returns
Type | Description |
---|---|
String | The CGI cookie with the given name. |
getCurrent(String)
Gets the value of the given key from the map of values common to all of the SuperOffice web applications running.
Declaration
String getCurrent(String key)
Parameters
Type | Name | Description |
---|---|---|
String | key | The key to get the value for. |
Returns
Type | Description |
---|---|
String | The corresponding value. |
getCurrentDate()
Returns the current date.
Declaration
Date getCurrentDate()
Returns
Type | Description |
---|---|
Date | The current date. |
Examples
print(getCurrentDate().toString());
Prints the date in YYYY-MM-DD format.
getCurrentDateTime()
Returns the current date and time.
Declaration
DateTime getCurrentDateTime()
Returns
Type | Description |
---|---|
DateTime |
Examples
print(getCurrentDateTime().toString());
Prints the date and time in YYYY-MM-DD XX:XX:XX format.
getCurrentTime()
Gets the current time.
Declaration
Time getCurrentTime()
Returns
Type | Description |
---|---|
Time | The current time. |
getCustomerMainEmail(Integer)
Returns the main email of the specified customer.
Declaration
String getCustomerMainEmail(Integer custId)
Parameters
Type | Name | Description |
---|---|---|
Integer | custId | The ID of the customer or person. |
Returns
Type | Description |
---|---|
String | An empty string is returned if the customer does not have an email address or the customer does not exist. |
getDbiControl()
Used to access the global DBI control object, which is used for database integration.
Declaration
DbiControl getDbiControl()
Returns
Type | Description |
---|---|
DbiControl | The global dbi control object. |
getDefaultElementConfig(Integer,String,String)
Returns the default config for an element type given a table and language.
Declaration
String getDefaultElementConfig(Integer type, String table, String language)
Parameters
Type | Name | Description |
---|---|---|
Integer | type | Type of element. Can be 14 (GenericGrid), 15 (InfoField), or 140 (Where) |
String | table | The table for the config (usually ticket, customer, company, or the name of an extratable) |
String | language | The language of the config. |
Returns
Type | Description |
---|---|
String | The config as a string with name = value lines. |
getDocumentId(String)
Returns the ID of the document with the given name.
Declaration
Integer getDocumentId(String name)
Parameters
Type | Name | Description |
---|---|---|
String | name | Name of the document. |
Returns
Type | Description |
---|---|
Integer | The ID of the document; -1 if no agent schedule was found. |
getEnvVariable(String)
Returns the OS environment variable with the given name. This method is not available in CRM Online.
Declaration
String getEnvVariable(String name)
Parameters
Type | Name | Description |
---|---|---|
String | name | The name of the variable. |
Returns
Type | Description |
---|---|
String | The OS environment variable with the given name. |
getEventData()
Returns an EventData object connected to the current event.
Declaration
EventData getEventData()
Returns
Type | Description |
---|---|
getExecutable()
Returns the executable with the full path that the current script is running in.
Declaration
String getExecutable()
Returns
Type | Description |
---|---|
String |
getExternalProgram(Integer)
Returns the external URL of the program module specified by progId (if available).
Declaration
String getExternalProgram(Integer progId)
Parameters
Type | Name | Description |
---|---|---|
Integer | progId | The ID of the program to return. |
Returns
Type | Description |
---|---|
String | The URL for the given program. |
Remarks
progId
progId | Integer | Hex |
modNull | 0 | 0x00000000 |
modTicket | 1 | 0x00000001 |
modAdmin | 2 | 0x00000002 |
modDocument | 4 | 0x00000004 |
modHelp | 8 | 0x00000008 |
modCustomer | 16 | 0x00000010 |
modKnowledge | 32 | 0x00000020 |
modPlanner | 64 | 0x00000040 |
modAds | 128 | 0x00000080 |
modSchedule | 256 | 0x00000100 |
modStat | 512 | 0x00000200 |
modRms | 1024 | 0x00000400 |
modCustLang | 2048 | 0x00000800 |
modExtDb | 4096 | 0x00001000 |
modAdvancedFAQ | 8192 | 0x00002000 |
modChat | 16384 | 0x00004000 |
modSpm | 32768 | 0x00008000 |
modSoap | 65536 | 0x00010000 |
modSoapPublic | 131072 | 0x00020000 |
modSms | 26214 | 0x00040000 |
modBlogic | 524288 | 0x00080000 |
modRetail | 1048576 | 0x00100000 |
getExternalProgramAdmin()
Returns the external URL of the program module specified after getProgram.
Declaration
String getExternalProgramAdmin()
Returns
Type | Description |
---|---|
String | The external URL for the given program. |
getExternalProgramAjax()
Returns the external URL of the program module specified after getProgram.
Declaration
String getExternalProgramAjax()
Returns
Type | Description |
---|---|
String | The external URL for the given program. |
getExternalProgramBlogic()
Returns the external URL of the program module specified after getProgram.
Declaration
String getExternalProgramBlogic()
Returns
Type | Description |
---|---|
String | The external URL for the given program. |
getExternalProgramChat()
Returns the external URL of the program module specified after getProgram.
Declaration
String getExternalProgramChat()
Returns
Type | Description |
---|---|
String |
getExternalProgramCustomer()
Returns the external URL of the program module specified after getProgram.
Declaration
String getExternalProgramCustomer()
Returns
Type | Description |
---|---|
String | The external URL for the given program. |
getExternalProgramDocument()
Returns the external URL of the program module specified after getProgram.
Declaration
String getExternalProgramDocument()
Returns
Type | Description |
---|---|
String | The external URL for the given program. |
getExternalProgramHelp()
Returns the external URL of the program module specified after getProgram.
Declaration
String getExternalProgramHelp()
Returns
Type | Description |
---|---|
String | The external URL for the given program. |
getExternalProgramKnowledge()
Returns the external URL of the program module specified after getProgram.
Declaration
String getExternalProgramKnowledge()
Returns
Type | Description |
---|---|
String | The external URL for the given program. |
getExternalProgramRms()
Returns the external URL of the program module specified after getProgram.
Declaration
String getExternalProgramRms()
Returns
Type | Description |
---|---|
String | The external URL for the given program. |
getExternalProgramSoap()
Returns the external URL of the program module specified after getProgram.
Declaration
String getExternalProgramSoap()
Returns
Type | Description |
---|---|
String | The external URL for the given program. |
getExternalProgramStat()
Returns the external URL of the program module specified after getProgram.
Declaration
String getExternalProgramStat()
Returns
Type | Description |
---|---|
String | The external URL for the given program. |
getExternalProgramTicket()
Returns the external URL of the program module specified after getProgram.
Declaration
String getExternalProgramTicket()
Returns
Type | Description |
---|---|
String | The external URL for the given program. |
getExtraTable(String)
Returns the ExtraTable instance for the given name.
Declaration
ExtraTable getExtraTable(String name)
Parameters
Type | Name | Description |
---|---|---|
String | name | The unique name of the table, such as "y_102", "y_inventory". |
Returns
Type | Description |
---|---|
ExtraTable | The ExtraTable. |
Remarks
Throws an exception if the table does not exist.
getFavourites(String)
Returns an array containing the IDs of all favorites in the given table.
Declaration
Integer[] getFavourites(String table)
Parameters
Type | Name | Description |
---|---|---|
String | table | Name of the table. |
Returns
Type | Description |
---|---|
Integer[] | Array containing IDs of favorites. |
getFunctionList()
Returns an array with the description of all CRMScript functions defined in the system.
Declaration
String[][] getFunctionList()
Returns
Type | Description |
---|---|
String[][] | Double String array with the description of all CRMScript functions. The inner array contains 0 - class name; 1 - return type; 2 - function name; 3 - parameter list; 4 - author. |
getGenericValue(Generic, String)
Returns a variable from the run-time environment given its name and independent of its type.
Declaration
Generic getGenericValue(Generic struct, String name)
Parameters
Type | Name | Description |
---|---|---|
Generic | struct | Generic Struct to get variable in. |
String | name | Name of variable to get. |
Returns
Type | Description |
---|---|
Generic | The variable as a Generic, independent of its type. |
Remarks
An exception is thrown if the name is unknown, or the struct is not a struct.
Examples
struct Person {
String name;
Integer age;
};
Person person;
person.age = 42;
Generic g = getGenericValue(person, "age");
getGenericValue(String)
Returns a variable from the run-time environment given its name and independent of its type.
You can optionally provide a struct to scope the variable.Declaration
Generic getGenericValue(String name)
Parameters
Type | Name | Description |
---|---|---|
String | name | A variable name. |
Returns
Type | Description |
---|---|
Generic | The variable as a Generic, independent of its type. |
Remarks
An exception is thrown if the name is unknown, or the struct is not a struct.
Examples
Integer age = 42;
Generic g = getGenericValue("age");
printLine(GenericToInteger(g).toString());
getGlobalStaticMap()
Returns a global and static map.
Declaration
Map getGlobalStaticMap()
Returns
Type | Description |
---|---|
Map |
Remarks
Useful to eliminate the need to fetch the same info several times within one run of the app, bLogic events and ticket save especially.
getGlobalVariable(String)
Gets a value from the global variables.
Declaration
String getGlobalVariable(String name)
Parameters
Type | Name | Description |
---|---|---|
String | name | The name of the variable to receive. |
Returns
Type | Description |
---|---|
String |
Remarks
Used for communication between different scripts.
getHtmlElement(String)
Returns a reference to an HtmlElement in the associated screen.
Declaration
HtmlElement getHtmlElement(String name)
Parameters
Type | Name | Description |
---|---|---|
String | name | The name of the element to return. |
Returns
Type | Description |
---|---|
HtmlElement | The HtmlElement with the given name. |
getHtmlElementIndex(String)
Gets the index of the specified HTML element. This is useful if you want to insert elements after a particular HTML element, and you do not know the index of it.
Declaration
Integer getHtmlElementIndex(String name)
Parameters
Type | Name | Description |
---|---|---|
String | name | The name of the HTML element you want to retrieve the index of. |
Returns
Type | Description |
---|---|
Integer | The index of the specified element. |
Remarks
Can only be called from a screen definition, it will fail if called from a regular script.
getHtmlElementName(Integer)
Returns the name of the element with the given index.
Declaration
String getHtmlElementName(Integer index)
Parameters
Type | Name | Description |
---|---|---|
Integer | index | Index of the element. |
Returns
Type | Description |
---|---|
String | The name of the element." |
getHttpHeader(String)
Returns the value of the specified header name.
Declaration
String getHttpHeader(String headerName)
Parameters
Type | Name | Description |
---|---|---|
String | headerName | Name of the header. |
Returns
Type | Description |
---|---|
String | The header value. |
Remarks
Header names
- ACCEPT-*
- ACCESS-CONTROL-REQUEST-METHOD
- ACCESS-CONTROL-REQUEST-HEADERS
- CACHE-CONTROL
- CONTENT-LENGTH
- CONTENT-TYPE
- DATE
- DNT
- EXPECT
- IF-*
- ORIGIN
- PRAGMA
- RANGE
- REFERER
- REQUEST-METHOD
- REQUEST-URI
- TE
- USER-AGENT
- X-CRMSCRIPT-*
- X-FORWARDED-FOR
- X-REQUESTED-WITH
- X-SUPEROFFICE-EVENT
- X-SUPEROFFICE-EVENTID
- X-SUPEROFFICE-RETRY
Examples
String method = getHttpHeader("REQUEST-METHOD");
getLanguageVariable(String)
Converts a language variable to a string in the language of the current user or, if provided, corresponding to a specific language code.
Declaration
String getLanguageVariable(String langVar)
Parameters
Type | Name | Description |
---|---|---|
String | langVar | The language variable, for example, lang_global_global_okSave. |
Returns
Type | Description |
---|---|
String | The language variable in the language given by language code or of the current user. |
Remarks
Searches in the language variables for the current screen in addition to the common language variables.
getLanguageVariable(String,String)
Converts a language variable to a string in the language of the current user or, if provided, corresponding to a specific language code.
Declaration
String getLanguageVariable(String langVar, String langCode)
Parameters
Type | Name | Description |
---|---|---|
String | langVar | The language variable, for example, lang_global_global_okSave |
String | langCode | The language code. |
Returns
Type | Description |
---|---|
String | The language variable in the language given by language code or of the current user. |
Remarks
Searches in the language variables for the current screen in addition to the common language variables.
getLocalTimeZone()
Returns the local timezone.
Declaration
TimeZone getLocalTimeZone()
Returns
Type | Description |
---|---|
TimeZone | The local timezone. |
getMainMenu()
Returns a reference to the global MainMenu instance.
Declaration
MainMenu getMainMenu()
Returns
Type | Description |
---|---|
MainMenu | The global MainMenu instance. |
Remarks
Used for changing the left-hand menu in the system.
getNtUser()
Returns the username supplied from the web server.
Declaration
String getNtUser()
Returns
Type | Description |
---|---|
String | Nt user name. |
Remarks
Works with Apache and IIS, but required user authentication on the web server.
Derived from UNMAPPED_REMOTE_USER or REMOTE_USER environment variablegetNumHtmlElements()
Returns the current number of the HtmlElements in the current screen.
Declaration
Integer getNumHtmlElements()
Returns
Type | Description |
---|---|
Integer | The current number of the HtmlElements in the current screen. |
getPID()
Returns the PID of the executable that the script is running in.
Declaration
Integer getPID()
Returns
Type | Description |
---|---|
Integer | The PID of the executable that the script is running in. |
getParser()
Returns a reference to the global Parser instance.
Declaration
Parser getParser()
Returns
Type | Description |
---|---|
Parser | The reference to the Parser instance. |
getParserParameter(String)
Returns the value of the given parameter in the global Parser instance.
Declaration
String getParserParameter(String name)
Parameters
Type | Name | Description |
---|---|---|
String | name | The name of the parameter. |
Returns
Type | Description |
---|---|
String | The value of the given parameter in the global Parser instance. |
Remarks
You can optionally pass the zero-based index of the value.
getParserParameter(String,Integer)
Returns the value of the given parameter at the zero-based index in the global Parser instance.
Declaration
String getParserParameter(String name, Integer index)
Parameters
Type | Name | Description |
---|---|---|
String | name | The name of the parameter |
Integer | index | The zero-based index of the value to return. |
Returns
Type | Description |
---|---|
String | The value of the given parameter in the global Parser instance. |
getParserParameterCount(String)
Returns the number of values for the given parameters in the global Parser object.
Declaration
Integer getParserParameterCount(String paramName)
Parameters
Type | Name | Description |
---|---|---|
String | paramName | The name of the parameter. |
Returns
Type | Description |
---|---|
Integer | The number of values for the parameter the Parser. |
getParserVariable(String)
Returns the (first) value for the given variable from the global Parser instance.
Declaration
String getParserVariable(String varName)
Parameters
Type | Name | Description |
---|---|---|
String | varName | The name of the variable. |
Returns
Type | Description |
---|---|
String |
Remarks
You can optionally pass the zero-based row of the parser-query result set.
getParserVariable(String,Integer)
Returns the (first) value for the given variable from the global Parser instance at the zero-based row of the parser-query result set.
Declaration
String getParserVariable(String varName, Integer row)
Parameters
Type | Name | Description |
---|---|---|
String | varName | The name of the variable |
Integer | row | The zero-based index of the value to return. |
Returns
Type | Description |
---|---|
String |
getParserVariableAsCSV(String,Bool)
Returns a variable from the global Parser instance as a comma-separated string.
Declaration
String getParserVariableAsCSV(String paramName, Bool forceQuoting)
Parameters
Type | Name | Description |
---|---|---|
String | paramName | The name of the variable to return. |
Bool | forceQuoting |
Returns
Type | Description |
---|---|
String | If True, then each element will be quoted. If false, only elements that need to be quoted (i.e. when they contain a comma) will be quoted. |
getParserVariableCount(String)
Returns the number of values for the specified value in the global Parser instance.
Declaration
Integer getParserVariableCount(String varName)
Parameters
Type | Name | Description |
---|---|---|
String | varName | The name of the variable. |
Returns
Type | Description |
---|---|
Integer | The number of values for the variable. |
getPriorityIdFromName(String)
Returns the ID of the priority with the given name.
Declaration
Integer getPriorityIdFromName(String name)
Parameters
Type | Name | Description |
---|---|---|
String | name | Name of the document." |
Returns
Type | Description |
---|---|
Integer | The ID of the priority. |
getProgram(Integer)
Returns the URL of the program module specified by progId.
Declaration
String getProgram(Integer progId)
Parameters
Type | Name | Description |
---|---|---|
Integer | progId |
Returns
Type | Description |
---|---|
String |
Remarks
progId
progId | Integer | Hex |
modNull | 0 | 0x00000000 |
modTicket | 1 | 0x00000001 |
modAdmin | 2 | 0x00000002 |
modDocument | 4 | 0x00000004 |
modHelp | 8 | 0x00000008 |
modCustomer | 16 | 0x00000010 |
modKnowledge | 32 | 0x00000020 |
modPlanner | 64 | 0x00000040 |
modAds | 128 | 0x00000080 |
modSchedule | 256 | 0x00000100 |
modStat | 512 | 0x00000200 |
modRms | 1024 | 0x00000400 |
modCustLang | 2048 | 0x00000800 |
modExtDb | 4096 | 0x00001000 |
modAdvancedFAQ | 8192 | 0x00002000 |
modChat | 16384 | 0x00004000 |
modSpm | 32768 | 0x00008000 |
modSoap | 65536 | 0x00010000 |
modSoapPublic | 131072 | 0x00020000 |
modSms | 26214 | 0x00040000 |
modBlogic | 524288 | 0x00080000 |
modRetail | 1048576 | 0x00100000 |
getProgramAdmin()
Returns the URL of the program module specified after getProgram.
Declaration
String getProgramAdmin()
Returns
Type | Description |
---|---|
String | The URL for the given program. |
getProgramAjax()
Returns the URL of the program module specified after getProgram.
Declaration
String getProgramAjax()
Returns
Type | Description |
---|---|
String | The URL for the given program. |
getProgramBlogic()
Returns the URL of the program module specified after getProgram.
Declaration
String getProgramBlogic()
Returns
Type | Description |
---|---|
String | The URL for the given program. |
getProgramChat()
Returns the URL of the program module specified after getProgram.
Declaration
String getProgramChat()
Returns
Type | Description |
---|---|
String | The URL for the given program. |
getProgramCustomer()
Returns the URL of the program module specified after getProgram.
Declaration
String getProgramCustomer()
Returns
Type | Description |
---|---|
String | The URL for the given program. |
getProgramDocument()
Returns the URL of the program module specified after getProgram.
Declaration
String getProgramDocument()
Returns
Type | Description |
---|---|
String | The URL for the given program. |
getProgramHelp()
Returns the URL of the program module specified after getProgram.
Declaration
String getProgramHelp()
Returns
Type | Description |
---|---|
String | The URL for the given program. |
getProgramKnowledge()
Returns the URL of the knowledge base (document.exe).
Declaration
String getProgramKnowledge()
Returns
Type | Description |
---|---|
String | The URL of the knowledge base (document.exe). |
getProgramRms()
Returns the URL of the program module specified after getProgram.
Declaration
String getProgramRms()
Returns
Type | Description |
---|---|
String | The URL for the given program. |
getProgramSoap()
Returns the URL of the program module specified after getProgram.
Declaration
String getProgramSoap()
Returns
Type | Description |
---|---|
String | The URL for the given program. |
getProgramStat()
Returns the URL of the program module specified after getProgram.
Declaration
String getProgramStat()
Returns
Type | Description |
---|---|
String | The URL for the given program. |
getProgramTicket()
Returns the URL of the program module specified after getProgram.
Declaration
String getProgramTicket()
Returns
Type | Description |
---|---|
String | The URL for the given program. |
getReplyTemplateBody(Integer,Bool,Integer)
Returns reply template text as specified by the parameters.
Declaration
String getReplyTemplateBody(Integer id, Bool useHTML, Integer langId)
Parameters
Type | Name | Description |
---|---|---|
Integer | id | The database ID of the template. |
Bool | useHTML | The HTML or plain text version? |
Integer | langId | The preferred language; -1 specifies default. |
Returns
Type | Description |
---|---|
String |
getReplyTemplateSubject(Integer,Integer)
Returns reply template subject.
Declaration
String getReplyTemplateSubject(Integer id, Integer langId)
Parameters
Type | Name | Description |
---|---|---|
Integer | id | The database ID of the template. |
Integer | langId | The preferred language; -1 specifies default. |
Returns
Type | Description |
---|---|
String |
getScreenElementConfig(Integer)
Returns the config of the screen element with the given index in the current screen definition.
Declaration
Map getScreenElementConfig(Integer index)
Parameters
Type | Name | Description |
---|---|---|
Integer | index | The index of the element. Can be retrieved with getHtmlElementIndex(elementName). |
Returns
Type | Description |
---|---|
Map | A map containing the config of the element. |
Remarks
Can only be called from a screen definition, it will fail if called from a regular script.
getScreenElementId(Integer)
Returns the ID of the screen element with the given index in the current screen definition.
Declaration
Integer getScreenElementId(Integer index)
Parameters
Type | Name | Description |
---|---|---|
Integer | index | The index of the element. Can be retrieved with getHtmlElementIndex(elementName). |
Returns
Type | Description |
---|---|
Integer | The ID of the element. |
Remarks
Can only be called from a screen definition, it will fail if called from a regular script.
getScreenElementName(Integer)
Returns the name of the screen element with the given index in the current screen definition.
Declaration
String getScreenElementName(Integer index)
Parameters
Type | Name | Description |
---|---|---|
Integer | index | The index of the element. Can be retrieved with getHtmlElementIndex(elementName). |
Returns
Type | Description |
---|---|
String | An integer defining the type of the element. |
Remarks
Can only be called from a screen definition, it will fail if called from a regular script.
getScreenElementType(Integer)
Returns the type of the screen element with the given index in the current screen definition.
Declaration
Integer getScreenElementType(Integer index)
Parameters
Type | Name | Description |
---|---|---|
Integer | index | The index of the element. Can be retrieved with getHtmlElementIndex(elementName). |
Returns
Type | Description |
---|---|
Integer |
Remarks
Can only be called from a screen definition, it will fail if called from a regular script.
Simple elements
- TypeAnchorLine = 1,
- TypeInfoFields = 2,
- TypeGrid = 3,
- TypeHR = 4,
- TypeBR = 5,
- TypeSubHeader = 6,
- TypeParserCode = 7,
- TypeMessages = 8,
- TypeEjScript = 9,
- TypeHtmlGrid = 10,
- TypePlanner = 11,
- TypeStaticGrid = 12,
- TypeDrillDown = 13,
- TypeGenericGrid = 14,
- TypeInfoFields2 = 15,
- TypeExtraTableEntriesGrid = 16,
- TypeDirectedAcyclicGraph = 17,
- TypeText = 101,
- TypeTextarea = 102,
- TypeSelectCategory = 103,
- TypeSelectCustomer = 104,
- TypeSelectCompany = 105,
- TypeSelectDate = 106,
- TypeSelectDateTime = 107,
- TypeSelectTime = 108,
- TypeButtonRow = 109,
- TypeCheckbox = 110,
- TypeEditor = 111,
- TypeInvoice = 112,
- TypeSelectUser = 113,
- TypeSelectExtraField = 114,
- TypeSelect = 115,
- TypeSendTo = 116,
- TypeSelectReplyTemplate = 117,
- TypeSelectTimeSpan = 118,
- TypeSelectRelation = 119,
- TypeSelectPriority = 120,
- TypeCc = 121,
- TypeAttachment = 122,
- TypeSelectSlevel = 123,
- TypeCustomers = 124,
- TypeSelectFaq = 125,
- TypeSelectDictionaryLang = 126,
- TypeButton = 127,
- TypeSelectMultipleRelations = 128,
- TypeTreeExplorer = 129,
- TypePinEdit = 130,
- TypeContactRecipients = 131,
- TypeTicketStatus = 132,
- TypeSelectMessage = 133,
- TypeCategoryMembership = 134,
- TypeAddressBook = 135,
- TypeRelatedDropdowns = 136,
- TypeSelectTicketStatus = 137,
- TypeSelectTable = 138,
- TypeFckEdit = 139,
- TypeWhere = 140,
- TypeSelectInsertText = 141,
- TypeRadioButtons = 142,
Groups
- TypeFieldset = 201,
- TypeLayoutTable = 202,
- TypePanes = 203,
- TypePane = 204,
- TypeVerticalTable = 205,
Group end marker
- TypeGroupEnd = 301
getScriptId(String)
Returns the ID of the script matching the parameter
Declaration
Integer getScriptId(String idString)
Parameters
Type | Name | Description |
---|---|---|
String | idString | The ID string of the script. |
Returns
Type | Description |
---|---|
Integer | The ID of the script matching the parameter; null if no match found. |
getSelectionIds(Integer)
Returns the IDs of the objects in the selection with the given ID.
Declaration
Integer[] getSelectionIds(Integer id)
Parameters
Type | Name | Description |
---|---|---|
Integer | id | ID of the selection. |
Returns
Type | Description |
---|---|
Integer[] | The IDs of the objects in the selection. |
getSessionVariable(String)
Makes it possible to store variables in the database which the web application can use as long as a session lives. That is until a user logs out.
Declaration
String getSessionVariable(String name)
Parameters
Type | Name | Description |
---|---|---|
String | name | Name of variable to read. |
Returns
Type | Description |
---|---|
String | String value if found. |
getSessionVariables()
Returns a map containing all session variables for the current session.
Declaration
Map getSessionVariables()
Returns
Type | Description |
---|---|
Map | All session variables for the current session. |
getStatusIdFromName(String)
Returns the ID of the status with the given name.
Declaration
Integer getStatusIdFromName(String name)
Parameters
Type | Name | Description |
---|---|---|
String | name | Name of the document. |
Returns
Type | Description |
---|---|
Integer | The ID of the status. |
getStructMembers(String)
Returns the variable names of a struct given its name. It does not includes functions in the list.
Declaration
String[] getStructMembers(String name)
Parameters
Type | Name | Description |
---|---|---|
String | name | Name of struct to find. |
Returns
Type | Description |
---|---|
String[] | String array of member names. |
Remarks
This is the names, not the actual values. To get those, call getGenericValue() using the member names.
getSystemFlags()
Gets the system flags. This is the same value as is stored in the database table config.flags.
Declaration
Integer getSystemFlags()
Returns
Type | Description |
---|---|
Integer | Flags. |
getSystemLang()
Returns the active system language.
Declaration
String getSystemLang()
Returns
Type | Description |
---|---|
String | The active system language. |
getTypeDimensions(Generic)
Returns the number of array dimensions for a variable. The argument is automatically up-casted to a Generic.
Declaration
Integer getTypeDimensions(Generic value)
Parameters
Type | Name | Description |
---|---|---|
Generic | value | The variable. |
Returns
Type | Description |
---|---|
Integer | Number of dimensions. |
Remarks
This is the number of dimensions in, not the length of, the array!
Examples
Integer[][] i;
printLine(getTypeDimensions(i).toString())
getTypeName(Generic)
Returns the type of a variable (will automatically be up-casted to generic).
Declaration
String getTypeName(Generic generic)
Parameters
Type | Name | Description |
---|---|---|
Generic | value | A variable of unknown type. |
Returns
Type | Description |
---|---|
String | The name of the type as a String. |
Examples
printLine(getTypeName(getCurrentDateTime()));
getUserLang()
Returns the active user language.
Declaration
String getUserLang()
Returns
Type | Description |
---|---|
String | The active user language. |
getUsername(Integer)
Gets username from the user ID.
Declaration
String getUsername(Integer userId)
Parameters
Type | Name | Description |
---|---|---|
Integer | userId | The user ID. |
Returns
Type | Description |
---|---|
String | Username. |
getVariable(String)
Returns the value in the global environment (used for communication between the script the calling context).
Declaration
String getVariable(String name)
Parameters
Type | Name | Description |
---|---|---|
String | name | The name of the variable. |
Returns
Type | Description |
---|---|
String | The value of the variable. |
getVariables()
Returns a map containing all run time environment variables (available through getVariable()).
Declaration
Map getVariables()
Returns
Type | Description |
---|---|
Map | All run time environment variables. |
getWarnings()
Returns a map of the current system warnings.
Declaration
Map getWarnings()
Returns
Type | Description |
---|---|
Map | The current system warnings. |
Remarks
Warnings are messages intended for system administrators, such as email failure warnings, expired FAQ entries, etc. They are normally listed on the status screen.
htmlConvToText(String)
Converts the given HTML text to plain text.
Declaration
String htmlConvToText(String text)
Parameters
Type | Name | Description |
---|---|---|
String | text | An HTML text. |
Returns
Type | Description |
---|---|
String | A textual version of the HTML text. |
idToLang(Integer)
Returns the code of the given language ID.
Declaration
String idToLang(Integer langId)
Parameters
Type | Name | Description |
---|---|---|
Integer | langId | Language Id. |
Returns
Type | Description |
---|---|
String | Language code of the given language Id. |
installPackage(String)
Installs a package provided as xml.
Declaration
String installPackage(String xml)
Parameters
Type | Name | Description |
---|---|---|
String | xml | XML of package to install |
Returns
Type | Description |
---|---|
String | Empty if no error, otherwise an error message. |
invoiceTypesExists()
Checks if invoice types exist in the database.
Declaration
Bool invoiceTypesExists()
Returns
Type | Description |
---|---|
Bool | True if there are invoice types; otherwise, False. |
isValidPhoneNumber(String,Bool)
Validates if it is a valid phonenumber
Declaration
Bool isValidPhoneNumber(String nr, Bool isMultiple)
Parameters
Type | Name | Description |
---|---|---|
String | nr | Number to check |
Bool | isMultiple | True if more than one phone number (comma separated). |
Returns
Type | Description |
---|---|
Bool | True if valid phone number; otherwise, false. |
langToId(String)
Returns the ID of the given language code.
Declaration
Integer langToId(String langCode)
Parameters
Type | Name | Description |
---|---|---|
String | langCode | Language code. |
Returns
Type | Description |
---|---|
Integer | ID of the given language code. If no match, it returns 0 (which is Norwegian). |
log(String)
Writes a message to the new log (the one in the database), which can be accessed with "rms?action=newLog".
Declaration
Void log(String msg)
Parameters
Type | Name | Description |
---|---|---|
String | msg | The message to write. |
Returns
Type | Description |
---|---|
Void |
logMessage(String)
Writes a message to the log file.
Declaration
Void logMessage(String message)
Parameters
Type | Name | Description |
---|---|---|
String | message | The message to log. |
Returns
Type | Description |
---|---|
Void |
makePassword(Integer)
Used to create a random password of length p, with the given seed charactersCreates and returns a random password of the given length. You can optionally pass the given seed characters.
Declaration
String makePassword(Integer length)
Parameters
Type | Name | Description |
---|---|---|
Integer | length | Length of password. |
Returns
Type | Description |
---|---|
String | A random password of the given length. |
makePassword(Integer,String)
Used to create a random password of length p, with the given seed charactersCreates and returns a random password of the given length.
Declaration
String makePassword(Integer length, String seed)
Parameters
Type | Name | Description |
---|---|---|
Integer | length | Length of password |
String | seed | Valid characters. |
Returns
Type | Description |
---|---|
String | A random password of the given length. |
mapValue(String)
Allocates a new map and maps the given value to the string "value".
Declaration
Map mapValue(String value)
Parameters
Type | Name | Description |
---|---|---|
String | value |
Returns
Type | Description |
---|---|
Map | A map containing the value. |
modulo(Integer,Integer)
Returns a modulo b. This can also be done with the syntax "a % b".
Declaration
Integer modulo(Integer a, Integer b)
Parameters
Type | Name | Description |
---|---|---|
Integer | a | The number to divide. |
Integer | b | The number to divide by. |
Returns
Type | Description |
---|---|
Integer | The result of a modulo b. |
parseJSON(String)
Parses a JSON document and generate a tree of XMLNode's.
Declaration
XMLNode parseJSON(String jsonDocument)
Parameters
Type | Name | Description |
---|---|---|
String | jsonDocument |
Returns
Type | Description |
---|---|
Remarks
This function has a bug. Empty arrays will still return one child. We recommend using parseJSON2()
instead where this bug has been fixed. Except for the fix, the function is identical. It is available from 8.4R03.
Examples
String jsonString = "{"menu": {"liste": [ "1", "2", "3", true, 123, 1.23 ],"id": "file","value": "File""tall": 1.234567,"sant": true,"usant": false,"tom": null,"popup": {"menuitem": [{"value": "New", "onclick":"CreateNewDoc()"},{"value": "Open", "onclick": "OpenDoc()"},{"value": "Close", "onclick": "CloseDoc()"}]}}}";
XMLNode xmlObject = parseJSON(jsonString); // Converts jsonString to XML
printLine(xmlObject.toJSON(0)); // Prints out the actual JSON content
//For example the following JSON document:
//
//{"menu": {
// "liste": [ "1", "2", "3", true, 123, 1.23 ],
// "id": "file",
// "value": "File",
// "tall": 1.234567,
// "sant": true,
// "usant": false,
// "tom": null,
// "popup": {
// "menuitem": [
// {"value": "New", "onclick": "CreateNewDoc()"},
// {"value": "Open", "onclick": "OpenDoc()"},
// {"value": "Close", "onclick": "CloseDoc()"}
// ]
// }
//}}
//
//
//Output:
//
//<root type="object">
// <menu type="object">
// <liste type="array">
// <item type="string">1</item>
// <item type="string">2</item>
// <item type="string">3</item>
// <item type="bool">true</item>
// <item type="number">123</item>
// <item type="number">1.23</item>
// </liste>
// <id type="string">file</id>
// <value type="string">File</value>
// <tall type="number">1.234567</tall>
// <sant type="bool">true</sant>
// <usant type="bool">false</usant>
// <tom type="null">null</tom>
// <popup type="object">
// <menuitem type="array">
// <item type="object">
// <value type="string">New</value>
// <onclick type="string">CreateNewDoc()</onclick>
// </item>
// <item type="object">
// <value type="string">Open</value>
// <onclick type="string">OpenDoc()</onclick>
// </item>
// <item type="object">
// <value type="string">Close</value>
// <onclick type="string">CloseDoc()</onclick>
// </item>
// </menuitem>
// </popup>
// </menu>
//</root>
parseJSON2(String)
Parses a JSON document and generate a tree of XMLNode's.
Declaration
XMLNode parseJSON2(String jsonDocument)
Parameters
Type | Name | Description |
---|---|---|
String | jsonDocument |
Returns
Type | Description |
---|---|
Examples
String jsonString = "{"menu": {"liste": [ "1", "2", "3", true, 123, 1.23 ],"id": "file","value": "File","tall": 1.234567,"sant": true,"usant": false,"tom": null,"popup": {"menuitem": [{"value": "New", "onclick": "CreateNewDoc()"},{"value": "Open", "onclick": "OpenDoc()"},{"value": "Close", "onclick": "CloseDoc()"}]}}}";
XMLNode xmlObject = parseJSON2(jsonString); // Converts jsonString to XML
printLine(xmlObject.toJSON(0)); // Prints out the actual JSON content
parseXML(String)
Parses an XML document and generate a tree of XMLNode's.
Declaration
XMLNode parseXML(String xmlDocument)
Parameters
Type | Name | Description |
---|---|---|
String | xmlDocument | The XML document. |
Returns
Type | Description |
---|---|
XMLNode | The root XMLNode. |
pauseTracing(Bool)
Pauses or unpauses script tracing, depending on the parameter. Multiple calls to pauseTracing(true) must be matched with an equal number of calls to pauseTracing(false) to unpause.
Declaration
Integer pauseTracing(Bool pause)
Parameters
Type | Name | Description |
---|---|---|
Bool | pause | Whether to pause (true) or unpause (false). |
Returns
Type | Description |
---|---|
Integer | The current pause level after process this call. |
pow()
The pow function returns base raised to the expth power.
Declaration
Float pow(Float base, Float exp)
Parameters
Type | Name | Description |
---|---|---|
Float | base | The base. |
Float | exp | The exponent. |
Returns
Type | Description |
---|---|
Float | The base raised to the expth power. If the base is zero and exp is less than or equal to zero, or the base is negative and exp is not an integer, an invalid float like -1.#IND0 will be returned. If the result is too large an invalid float like 1.#INF0 will be returned. |
print(String)
Prints the string to the screen.
Declaration
Void print(String s)
Parameters
Type | Name | Description |
---|---|---|
String | s | The string to print. |
Returns
Type | Description |
---|---|
Void |
Remarks
Will only work in certain contexts (when there is a screen to print to).
printBinary(Byte[])
Outputs the bytes to the standard output stream. You can pass the data to encode as either Byte[] or NSStream.
Declaration
Void printBinary(Byte[])
Parameters
Type | Name | Description |
---|---|---|
Byte[] | data | The binary data to output. |
Returns
Type | Description |
---|---|
Void |
printBinary(NSStream)
Outputs the bytes to the standard output stream. You can pass the data to encode as either Byte[] or NSStream.
Declaration
Void printBinary(NSStream)
Parameters
Type | Name | Description |
---|---|---|
NSStream | data | The binary data to output. |
Returns
Type | Description |
---|---|
Void |
printDebug(String)
Adds the input debug to the debug string which will be shown in the debug window.
Declaration
Void printDebug(String debug)
Parameters
Type | Name | Description |
---|---|---|
String | debug | The string to print. |
Returns
Type | Description |
---|---|
Void |
printLine(String)
Prints lines into standard output without appending \r\n in p_line.
Declaration
Void printLine(String line)
Parameters
Type | Name | Description |
---|---|---|
String | line | The line to print." |
Returns
Type | Description |
---|---|
Void |
rand(Integer,Integer)
Returns a random value between min and max. The seed is set by the cgi application when it is invoked.
Declaration
Integer rand(Integer min, Integer max)
Parameters
Type | Name | Description |
---|---|---|
Integer | min | The minimum value to return. |
Integer | max | The maximum value to return. |
Returns
Type | Description |
---|---|
Integer | A random value min <= r <= max. |
reloadAndSendShipment(Integer)
Reloads mailings selections and schedule to send again immediately.
Declaration
Bool reloadAndSendShipment(Integer shipmentId)
Parameters
Type | Name | Description |
---|---|---|
Integer | shipmentId |
Returns
Type | Description |
---|---|
Bool | True if it worked; False if it did not work, because the mailing was in an illegal state for this operation. |
Remarks
Used when you have added more people to the selection and want to send to them as well.
removeHtmlElement(Integer)
Removes the element with the given index
Declaration
Void removeHtmlElement(Integer index)
Parameters
Type | Name | Description |
---|---|---|
Integer | index | The index of the element to remove. |
Returns
Type | Description |
---|---|
Void |
Remarks
Can only be called from a screen definition, it will fail if called from a regular script
removePackage(String)
Removes the package with the given name.
Declaration
String removePackage(String name)
Parameters
Type | Name | Description |
---|---|---|
String | name | Name of package to remove |
Returns
Type | Description |
---|---|
String | Empty if no error, otherwise an error message. |
resetChat(Integer)
Resets a chat session and places it in queue/pre-chat-form/offline-form depending on the topic's settings.
Declaration
Void resetChat(Integer sessionId)
Parameters
Type | Name | Description |
---|---|---|
Integer | sessionId |
Returns
Type | Description |
---|---|
Void |
Remarks
Typically called when a Bot wants to transfer a chat session to a human user agent.
runProgram(String)
Executes the program (given command) and returns what was sent to stdout. This method is not available in CRM Online.
Declaration
String runProgram(String command)
Parameters
Type | Name | Description |
---|---|---|
String | command | Command line path to program and parameters. |
Returns
Type | Description |
---|---|
String |
Remarks
The owner of the process running the CRMScript needs permissions to execute the program. You can optionally pass the codepage used.
runProgram(String,String)
Executes the program (given command) with a codepage and returns what was sent to stdout. This method is not available in CRM Online.
Declaration
String runProgram(String command, String codepage)
Parameters
Type | Name | Description |
---|---|---|
String | command | Command line path to program and parameters |
String | codepage | The codepage used. |
Returns
Type | Description |
---|---|
String |
Remarks
The owner of the process running the CRMScript needs permissions to execute the program.
saveAllCgiAttachments(String)
Saves all cgi attachments with the given name.
Declaration
Integer[] saveAllCgiAttachments (String name)
Parameters
Type | Name | Description |
---|---|---|
String | name | The name of attachments to be saved. |
Returns
Type | Description |
---|---|
Integer[] | An array containing the attachment IDs of all the saved attachments. |
saveCgiAttachment(String)
Saves the attachment in cgi variable with the name given and returns the ID of the attachment record in the attachment table.
Declaration
Integer saveCgiAttachment(String varName)
Parameters
Type | Name | Description |
---|---|---|
String | varName | The name of cgi variable. |
Returns
Type | Description |
---|---|
Integer | The ID of the saved attachment. |
setChatStatus(Integer,Integer)
Changes the status of a chat session.
Declaration
Void SetChatStatus(Integer sessionId, Integer status)
Parameters
Type | Name | Description |
---|---|---|
Integer | sessionId | |
Integer | status |
Returns
Type | Description |
---|---|
Void |
Remarks
The available statuses are:
- StatusInvalid = 0,
- StatusPreChatForm = 1,
- StatusFaq = 2,
- StatusOfflineForm = 3,
- StatusInQueue = 4,
- StatusCustomerLast = 5,
- StatusUserLast = 6,
- StatusFinished = 7,
- StatusDeleted = 8,
- StatusClosed = 9,
- StatusRequestPosted = 10,
setCookie(String,String,Bool)
This method is not available in CRM Online.
Declaration
Void setCookie(String name, String value, Bool persistent)
Parameters
Type | Name | Description |
---|---|---|
String | name | |
String | value | |
Bool | persistent |
Returns
Type | Description |
---|---|
Void |
Remarks
NB! Doesn't work in the customer center, use parser variable with an underscore (_) instead.
setCurrent(String,String)
Maps the given key and value in the map of the values common for all the SuperOffice web applications running.
Declaration
Void SetCurrent(String key, String value)
Parameters
Type | Name | Description |
---|---|---|
String | key | |
String | value |
Returns
Type | Description |
---|---|
Void |
setFromCgi()
Sets all the elements of the associated screen from the global CGI instance. This is normally done when a screen is loaded/reloaded but after the load script.
Declaration
Void SetFromCgi()
Returns
Type | Description |
---|---|
Void |
Remarks
This function allows one to force this element initialization in the script, so that values may be accessed.n
setGenericFromString(Generic, String)
Sets the value of a variable from a string. It supports only basic types.
In combination with for example getStructMembers() and getGenericValue(), this function can be used to iterate a struct and set all its members programmatically instead of having to explicit hard-code each one of them.Declaration
Void setGenericFromString(Generic generic, String value)
Parameters
Type | Name | Description |
---|---|---|
Generic | generic | The variable to set. |
String | value | The the constructor data for the Generic. |
Returns
Type | Description |
---|---|
Void |
Remarks
Attempting to set an array or a complex type will throw an exception.
The value must be formatted according to the constructor of that type. Specifically, Date, DateTime, and Time must be on the YYYY-MM-DD HH:MI:SS format.setGlobalVariable(String,String)
Sets the value of a global variable (used for communication between different scripts).
Declaration
Void SetGlobalVariable(String name, String value)
Parameters
Type | Name | Description |
---|---|---|
String | name | The name of the variable. |
String | value | The value of the variable. |
Returns
Type | Description |
---|---|
Void |
setHidden(String,String)
Sets the value of a hidden variable in the associated screen. Hidden variables are values that are carried through a screen, and which can be accessed by the following scripts.
Declaration
Void SetHidden(String name, String value)
Parameters
Type | Name | Description |
---|---|---|
String | name | The name of the variable. |
String | value | The value of the variable. |
Returns
Type | Description |
---|---|
Void |
setPageFocusFirstControl(Bool)
Used to set focus to first control in screens.
Declaration
Void SetPageFocusFirstControl(Bool p0)
Parameters
Type | Name | Description |
---|---|---|
Bool | p0 |
Returns
Type | Description |
---|---|
Void |
setPageOnLoad(String)
Void setPageOnLoad(String onLoad)
Declaration
Void SetPageOnLoad(String p0)
Parameters
Type | Name | Description |
---|---|---|
String | onLoad |
Returns
Type | Description |
---|---|
Void |
setPageRefresh(Integer)
Sets the page meta refresh to the specified seconds, thus making the screen refresh.
Declaration
Void SetPageRefresh(Integer seconds)
Parameters
Type | Name | Description |
---|---|---|
Integer | seconds | Number of seconds for the refresh. |
Returns
Type | Description |
---|---|
Void |
Remarks
If this method is used in a script that is not connected to a screen, nothing will happen.
setPageTitle(String)
Alters the page title. You will be able to set the text after the version information.
Declaration
Void SetPageTitle(String title)
Parameters
Type | Name | Description |
---|---|---|
String | title |
Returns
Type | Description |
---|---|
Void |
setParserVariable(String,String)
Sets (adds) a variable to the global Parser instance.
Declaration
Void SetParserVariable(String name, String value)
Parameters
Type | Name | Description |
---|---|---|
String | name | The name of the variable. |
String | value | The value of the variable. |
Returns
Type | Description |
---|---|
Void |
setSessionVariable(String,String)
Writes a SessionObject entry to the databaseWrites a SessionObject entry to the database.
Declaration
String setSessionVariable(String name, String value)
Parameters
Type | Name | Description |
---|---|---|
String | name | Name of variable. May be empty, in which case the ID of the first row will be used. |
String | value | Value to store. |
Returns
Type | Description |
---|---|
String |
Remarks
Stores variables in the database that the web application can use as long as a session lives (until a user logs out).
setUserIsTyping(Integer,Bool)
Sets or clears the "User is typing" flag of a chat session.
Declaration
Void SetUserIsTyping(Integer sessionId, Bool isTyping)
Parameters
Type | Name | Description |
---|---|---|
Integer | sessionId | |
Bool | isTyping |
Returns
Type | Description |
---|---|
Void |
setVariable(String,String)
Sets the value in the global environment (used for communication between the script the calling context).
Declaration
Void SetVariable(String name, String value)
Parameters
Type | Name | Description |
---|---|---|
String | name | The name of the variable. |
String | value | The value of the variable. |
Returns
Type | Description |
---|---|
Void |
simpleTwoWay(Byte[])
Simple two-way data encryption. Data -> Encrypted data -> data
Declaration
Byte[] simpleTwoWay(Byte[] data)
Parameters
Type | Name | Description |
---|---|---|
Byte[] | data | Byte array to encrypt/decrypt. |
Returns
Type | Description |
---|---|
Byte[] | Byte array with encrypted/decrypted data. |
sleep()
Sleeps (give up CPU) for some time.
Declaration
Void sleep(Float seconds)
Parameters
Type | Name | Description |
---|---|---|
Float | second | Number of seconds to sleep. |
Returns
Type | Description |
---|---|
Void |
Remarks
Useful in some CPU-intensive loops to maintain a responsive system.
Examples
sleep(01); //sleeps for about one-tenth of a second.
typeIsStruct(Generic)
Checks whether a variable is a struct or not. Any variable can be checked. The argument is automatically up-casted to a Generic.
Declaration
Bool typeIsStruct(Generic generic)
Parameters
Type | Name | Description |
---|---|---|
Generic | value | The variable to check. |
Returns
Type | Description |
---|---|
Bool | True if the variable is a struct. |
Examples
struct Person {
String name;
Integer age;
};
Person p;
if (typeIsStruct(p)) {
printLine("10-4");
}