Class Void
Global functions
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 <strong>OK</strong>. |
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 |
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 |
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 |
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. |
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. |
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 |
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 |
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 |
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 |
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 |
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). |
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. |
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. |
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. |
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. |
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 |
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 |
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. |
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. |
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. |
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). |
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. |
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. |
encodeSHA1(String)
Generates and returns a hash from a specified value using the SHA1 encoding algorithm.
Declaration
String encodeSHA1(String value)
Examples
String s = "Hello world!";
printLine(encodeSHA1("Hello there!")); // Prints "6b19cb3790b6da8f7c34b4d8895d78a56d078624"
printLine(encodeSHA1("Hello world!")); // Prints "d3486ae9136e7856bc42212385ea797094475802"
printLine(encodeSHA1(s)); // Prints "d3486ae9136e7856bc42212385ea797094475802"
Parameters
Type | Name | Description |
String | value | The value to be hashed. |
Returns
Type | Description |
String | The generated hash (formatted as hex). |
encodeSHA256(String,String)
Generates and returns a hash from a specified key-value pair using the HMAC SHA256 encoding algorithm.
Declaration
String encodeSHA256(String key, String value)
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"
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). |
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 |
executeScript(String,Map)
Declaration
String executeScript(String script, Map values)
Parameters
Type | Name | Description |
String | script | Actual CRMScript code to execute |
Map | values |
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! |
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 |
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 | 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 |
Parser | The reference to the Parser instance. |
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)
Examples
forceSaveTrace(true);
Will save the trace if the other conditions are met.
Parameters
Type | Name | Description |
Bool | doSave | Whether to save or not |
Returns
Type | Description |
Void |
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 |
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. |
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()
Examples
print(getCurrentDate().toString());
Prints the date in YYYY-MM-DD format.
Returns
Type | Description |
Date | The current date. |
getCurrentDateTime()
Returns the current date and time.
Declaration
DateTime getCurrentDateTime()
Examples
print(getCurrentDateTime().toString());
Prints the date and time in YYYY-MM-DD XX:XX:XX format.
Returns
Type | Description |
DateTime |
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 |
EventData | EventData object connected to the current event |
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. |
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. |
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. |
getGlobalStaticMap()
Returns a global and static map.
Declaration
Map getGlobalStaticMap()
Returns
Type | Description |
Map |
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 |
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. |
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)
Examples
String method = getHttpHeader("REQUEST-METHOD");
Parameters
Type | Name | Description |
String | headerName | Name of the header. |
Returns
Type | Description |
String | The header value. |
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. |
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. |
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. |
getNtUser()
Returns the username supplied from the web server.
Declaration
String getNtUser()
Returns
Type | Description |
String | Nt user name. |
getNumHtmlElements()
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. |
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. |
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 |
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. |
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. |
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 |
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. |
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. |
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. |
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 |
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. |
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. |
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. |
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)
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>
Parameters
Type | Name | Description |
String | jsonDocument |
Returns
Type | Description |
XMLNode |
parseJSON2(String)
Parses a JSON document and generate a tree of XMLNode's.
Declaration
XMLNode parseJSON2(String jsonDocument)
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
Parameters
Type | Name | Description |
String | jsonDocument |
Returns
Type | Description |
XMLNode |
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 |
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. |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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)
Examples
sleep(01); //sleeps for about one-tenth of a second.
Parameters
Type | Name | Description |
Float | second | Number of seconds to sleep. |
Returns
Type | Description |
Void |
getTypeName(Generic)
Returns the type of a variable (will automatically be up-casted to generic).
Declaration
String getTypeName(Generic generic)
Examples
printLine(getTypeName(getCurrentDateTime()));
Parameters
Type | Name | Description |
Generic | value | A variable of unknown type. |
Returns
Type | Description |
String | The name of the type as a String. |
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)
Examples
struct Person {
String name;
Integer age;
};
Person person;
person.age = 42;
Generic g = getGenericValue(person, "age");
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. |
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)
Examples
Integer age = 42;
Generic g = getGenericValue("age");
printLine(GenericToInteger(g).toString());
Parameters
Type | Name | Description |
String | name | A variable name. |
Returns
Type | Description |
Generic | The variable as a Generic, independent of its type. |
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. |
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. |
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. |
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. |
convertGenericToString(Generic)
Returns the string representation of a variable. The argument is automatically be up-casted to a Generic.
Declaration
String convertGenericToString(Generic variable)
Examples
Integer age = 42;
String s = convertGenericToString(age);
printLine(s);
Parameters
Type | Name | Description |
Generic | variable | The variable to convert. |
Returns
Type | Description |
String | The string representation of the value in the Generic. |
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 |
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. |
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. |
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. |
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. |
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. |
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. |
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)
Examples
Integer[][] i;
printLine(getTypeDimensions(i).toString())
Parameters
Type | Name | Description |
Generic | value | The variable. |
Returns
Type | Description |
Integer | Number of dimensions. |
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)
Examples
struct Person {
String name;
Integer age;
};
Person p;
if (typeIsStruct(p)) {
printLine("10-4");
}
Parameters
Type | Name | Description |
Generic | value | The variable to check. |
Returns
Type | Description |
Bool | True if the variable is a struct. |
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. |