Skip to main content
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.
Returns: CRMScript.Global.Void
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.
Returns: CRMScript.Global.Integer
You can optionally pass a <code>DateTime</code> 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.
Returns: CRMScript.Global.Integer
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.
Returns: CRMScript.Native.HtmlElement - The element that was added.
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.
Returns: CRMScript.Native.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.
Returns: CRMScript.Native.HtmlElement - The element that was added.
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.
Returns: CRMScript.Native.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.
Returns: CRMScript.Global.Void
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.
Returns: CRMScript.Global.Void
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.
Returns: CRMScript.Global.Void
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.
Returns: CRMScript.Global.Void
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.
Returns: CRMScript.Global.Void
Used primarily with unit testing.

authenticateCustomer(String,String)

Checks a customer’s username and password. Returns personId if successful, otherwise a null Integer.
Returns: CRMScript.Global.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.
Returns: CRMScript.Global.String - All POST and GET variables for the current URL.

cgiWasPost()

Checks if the CGI HTTP request was of type POST.
Returns: CRMScript.Global.Bool - True if the CGI HTTP request was of type POST (not GET or anything else).
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.
Returns: CRMScript.Global.Bool - True if it is ok to send a receipt to the indicated email address; otherwise, false.
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.
Returns: CRMScript.Global.String - HTML string.
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.

convertStatus(Integer)

Converts a status given by its integer identifier to its string representation.
Returns: CRMScript.Global.String - The status as a string.
The method is language-dependent.

copyCRMDocumentToAttachment(Integer)

Copies the content of a CRM Document, given the ID, to a new Service attachment.
Returns: CRMScript.Global.Integer - The ID of the newly created Service attachment.
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.
Returns: CRMScript.Global.Void

decodeBase64(String)

Decodes a base64-encoded string into a byte array.
Returns: CRMScript.Global.Byte[] - Decoded byte array.

decodeBase64AsStream(String)

Decodes a base64-encoded string into an NSStream.
Returns: CRMScript.NetServer.NSStream

decodeDBValue(String)

Decodes the value returned by for example NetServer archives, i.e [I:23], and returns the value as a string.
Returns: CRMScript.Global.String
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.
Returns: CRMScript.Global.Void
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.
Returns: CRMScript.Global.String - A base32-encoded string.

encodeBase64(Byte[])

Encodes bytes to a base64 string.
Returns: CRMScript.Global.String - A base64-encoded string.
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.
Returns: CRMScript.Global.String - A base64-encoded string.

encodeBase64(NSStream)

Encodes bytes to a base64 string.
Returns: CRMScript.Global.String - A base64-encoded string.
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.
Returns: CRMScript.Global.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.
Returns: CRMScript.Global.Byte[] - The generated hash.
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.
Returns: CRMScript.Global.String - The generated hash (formatted as hex).
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.
Returns: CRMScript.Global.Byte[] - The generated hash.
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.
Returns: CRMScript.Global.Byte[] - The generated hash.
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.
Returns: CRMScript.Global.String - The generated hash (formatted as hex).
This can be used to ensure data integrity. The hash cannot be decrypted back.
Example:

encodeSHA256(String,String)

Generates and returns a hash from a specified key-value pair using the HMAC SHA256 encoding algorithm.
Returns: CRMScript.Global.String - The generated hash. The same key-value pair always returns the same hash (formatted as hex).
This can be used to ensure data integrity. The hash cannot be decrypted back.
Example:

executeDbiAgentSchedule(Integer,Map)

Manually starts a DBI agent schedule. It is possible to supply a map of parameter values used by the schedule.
Returns: CRMScript.Global.Void

executeMacro(String)

The outermost function for executing a macro.
Returns: CRMScript.Global.String

executeScript(String,Map)

Returns: CRMScript.Global.String
Function to execute CRMScript code supplied.

executeSQLQuery(String)

Executes the specified SQL statement. This function is not available in CRM Online!
Returns: CRMScript.Global.Void - Does not return anything!
In case of an error in the SQL statement, an exception will be thrown.

exitWithMessage(String)

Exits running the rest of the script and displays a message with text from the parameter.
Returns: CRMScript.Global.Void
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.
Returns: CRMScript.Native.Parser - The reference to the Parser instance.
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.
Returns: CRMScript.Global.Integer - The ID of the reply template to use.

flushCaches()

Flushes the caches in NetServer.
Returns: CRMScript.Global.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.
Returns: CRMScript.Global.Void Example:

forwardMail(String,String,Integer)

Forwards preformatted email.
Returns: CRMScript.Global.Void

getActiveUser()

Returns a reference to the active user instance.
Returns: CRMScript.Native.User - A reference to the active user instance.

getAgentId(String)

Returns the ID of the agent matching the parameter.
Returns: CRMScript.Global.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.
Returns: CRMScript.Global.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.
Returns: CRMScript.Global.Integer - The total size of the specified attachments.

getCategoryIdFromFullname(String)

Finds category ID from the category’s full name.
Returns: CRMScript.Global.Integer - ID of category.

getCgiContent()

Returns the raw content of the HTTP request.
Returns: CRMScript.Global.String - The raw content of the HTTP request.

getCgiUrl()

Returns the cgiUrl value from the config table. For example, http://ejournal.company.com
Returns: CRMScript.Global.String - The string stored as the cgiUrl.
Used for creating URLs.

getCgiVariable(String)

Returns the CGI variable with the given name.
Returns: CRMScript.Global.String - The CGI variable with the given name.

getCgiVariableArray(String)

Returns a string array of all CGI variables matching the given name
Returns: CRMScript.Global.String[] - All CGI variables matching the given name.

getCgiVariables()

Returns a map of all CGI variables.
Returns: CRMScript.Native.Map - Map containing all CGI variables.

getCookie(String)

Returns the CGI cookie with the given name. This method is not available in CRM Online.
Returns: CRMScript.Global.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.
Returns: CRMScript.Global.String - The corresponding value.

getCurrentDate()

Returns the current date.
Returns: CRMScript.Global.Date - The current date. Example:

getCurrentDateTime()

Returns the current date and time.
Returns: CRMScript.Global.DateTime Example:

getCurrentTime()

Gets the current time.
Returns: CRMScript.Global.Time - The current time.

getCustomerMainEmail(Integer)

Returns the main email of the specified customer.
Returns: CRMScript.Global.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.
Returns: CRMScript.Native.DbiControl - The global dbi control object.

getDefaultElementConfig(Integer,String,String)

Returns the default config for an element type given a table and language.
Returns: CRMScript.Global.String - The config as a string with name = value lines.

getDocumentId(String)

Returns the ID of the document with the given name.
Returns: CRMScript.Global.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.
Returns: CRMScript.Global.String - The OS environment variable with the given name.

getEventData()

Returns an EventData object connected to the current event.
Returns: CRMScript.Native.EventData - EventData object connected to the current event

getExecutable()

Returns the executable with the full path that the current script is running in.
Returns: CRMScript.Global.String

getExternalProgram(Integer)

Returns the external URL of the program module specified by progId (if available).
Returns: CRMScript.Global.String - The URL for the given program.

progId

getExternalProgramAdmin()

Returns the external URL of the program module specified after getProgram.
Returns: CRMScript.Global.String - The external URL for the given program.

getExternalProgramAjax()

Returns the external URL of the program module specified after getProgram.
Returns: CRMScript.Global.String - The external URL for the given program.

getExternalProgramBlogic()

Returns the external URL of the program module specified after getProgram.
Returns: CRMScript.Global.String - The external URL for the given program.

getExternalProgramChat()

Returns the external URL of the program module specified after getProgram.
Returns: CRMScript.Global.String

getExternalProgramCustomer()

Returns the external URL of the program module specified after getProgram.
Returns: CRMScript.Global.String - The external URL for the given program.

getExternalProgramDocument()

Returns the external URL of the program module specified after getProgram.
Returns: CRMScript.Global.String - The external URL for the given program.

getExternalProgramHelp()

Returns the external URL of the program module specified after getProgram.
Returns: CRMScript.Global.String - The external URL for the given program.

getExternalProgramKnowledge()

Returns the external URL of the program module specified after getProgram.
Returns: CRMScript.Global.String - The external URL for the given program.

getExternalProgramRms()

Returns the external URL of the program module specified after getProgram.
Returns: CRMScript.Global.String - The external URL for the given program.

getExternalProgramSoap()

Returns the external URL of the program module specified after getProgram.
Returns: CRMScript.Global.String - The external URL for the given program.

getExternalProgramStat()

Returns the external URL of the program module specified after getProgram.
Returns: CRMScript.Global.String - The external URL for the given program.

getExternalProgramTicket()

Returns the external URL of the program module specified after getProgram.
Returns: CRMScript.Global.String - The external URL for the given program.

getExtraTable(String)

Returns the ExtraTable instance for the given name.
Returns: CRMScript.Native.ExtraTable - The ExtraTable.
Throws an exception if the table does not exist.

getFavourites(String)

Returns an array containing the IDs of all favorites in the given table.
Returns: CRMScript.Global.Integer[] - Array containing IDs of favorites.

getFunctionList()

Returns an array with the description of all CRMScript functions defined in the system.
Returns: CRMScript.Global.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.
Returns: CRMScript.Native.Map
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.
Returns: CRMScript.Global.String
Used for communication between different scripts.

getHtmlElement(String)

Returns a reference to an HtmlElement in the associated screen.
Returns: CRMScript.Native.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.
Returns: CRMScript.Global.Integer - The index of the specified element.
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.
Returns: CRMScript.Global.String - The name of the element.

getHttpHeader(String)

Returns the value of the specified header name.
Returns: CRMScript.Global.String - The header value.

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
Example:

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.
Returns: CRMScript.Global.String - The language variable in the language given by language code or of the current user.
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.
Returns: CRMScript.Global.String - The language variable in the language given by language code or of the current user.
Searches in the language variables for the current screen in addition to the common language variables.

getLocalTimeZone()

Returns the local timezone.
Returns: CRMScript.Global.TimeZone - The local timezone.

getMainMenu()

Returns a reference to the global MainMenu instance.
Returns: CRMScript.Native.MainMenu - The global MainMenu instance.
Used for changing the left-hand menu in the system.

getNtUser()

Returns the username supplied from the web server.
Returns: CRMScript.Global.String - Nt user name.
Works with Apache and IIS, but required user authentication on the web server.Derived from UNMAPPED_REMOTE_USER or REMOTE_USER environment variable

getNumHtmlElements()

Returns the current number of the HtmlElements in the current screen.
Returns: CRMScript.Global.Integer - The current number of the HtmlElements in the current screen.

getParser()

Returns a reference to the global Parser instance.
Returns: CRMScript.Native.Parser - The reference to the Parser instance.

getParserParameter(String)

Returns the value of the given parameter in the global Parser instance.
Returns: CRMScript.Global.String - The value of the given parameter in the global Parser instance.
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.
Returns: CRMScript.Global.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.
Returns: CRMScript.Global.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.
Returns: CRMScript.Global.String
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.
Returns: CRMScript.Global.String

getParserVariableAsCSV(String,Bool)

Returns a variable from the global Parser instance as a comma-separated string.
Returns: CRMScript.Global.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.
Returns: CRMScript.Global.Integer - The number of values for the variable.

getPID()

Returns the PID of the executable that the script is running in.
Returns: CRMScript.Global.Integer - The PID of the executable that the script is running in.

getPriorityIdFromName(String)

Returns the ID of the priority with the given name.
Returns: CRMScript.Global.Integer - The ID of the priority.

getProgram(Integer)

Returns the URL of the program module specified by progId.
Returns: CRMScript.Global.String

progId

getProgramAdmin()

Returns the URL of the program module specified after getProgram.
Returns: CRMScript.Global.String - The URL for the given program.

getProgramAjax()

Returns the URL of the program module specified after getProgram.
Returns: CRMScript.Global.String - The URL for the given program.

getProgramBlogic()

Returns the URL of the program module specified after getProgram.
Returns: CRMScript.Global.String - The URL for the given program.

getProgramChat()

Returns the URL of the program module specified after getProgram.
Returns: CRMScript.Global.String - The URL for the given program.

getProgramCustomer()

Returns the URL of the program module specified after getProgram.
Returns: CRMScript.Global.String - The URL for the given program.

getProgramDocument()

Returns the URL of the program module specified after getProgram.
Returns: CRMScript.Global.String - The URL for the given program.

getProgramHelp()

Returns the URL of the program module specified after getProgram.
Returns: CRMScript.Global.String - The URL for the given program.

getProgramKnowledge()

Returns the URL of the knowledge base (document.exe).
Returns: CRMScript.Global.String - The URL of the knowledge base (document.exe).

getProgramRms()

Returns the URL of the program module specified after getProgram.
Returns: CRMScript.Global.String - The URL for the given program.

getProgramSoap()

Returns the URL of the program module specified after getProgram.
Returns: CRMScript.Global.String - The URL for the given program.

getProgramStat()

Returns the URL of the program module specified after getProgram.
Returns: CRMScript.Global.String - The URL for the given program.

getProgramTicket()

Returns the URL of the program module specified after getProgram.
Returns: CRMScript.Global.String - The URL for the given program.

getReplyTemplateBody(Integer,Bool,Integer)

Returns reply template text as specified by the parameters.
Returns: CRMScript.Global.String

getReplyTemplateSubject(Integer,Integer)

Returns reply template subject.
Returns: CRMScript.Global.String

getScreenElementConfig(Integer)

Returns the config of the screen element with the given index in the current screen definition.
Returns: CRMScript.Native.Map - A map containing the config of the element.
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.
Returns: CRMScript.Global.Integer - The ID of the element.
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.
Returns: CRMScript.Global.String - An integer defining the type of the element.
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.
Returns: CRMScript.Global.Integer
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,

Form elements

  • 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
Returns: CRMScript.Global.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.
Returns: CRMScript.Global.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.
Returns: CRMScript.Global.String - String value if found.

getSessionVariables()

Returns a map containing all session variables for the current session.
Returns: CRMScript.Native.Map - All session variables for the current session.

getStatusIdFromName(String)

Returns the ID of the status with the given name.
Returns: CRMScript.Global.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.
Returns: CRMScript.Global.Integer - Flags.

getSystemLang()

Returns the active system language.
Returns: CRMScript.Global.String - The active system language.

getUserLang()

Returns the active user language.
Returns: CRMScript.Global.String - The active user language.

getUsername(Integer)

Gets username from the user ID.
Returns: CRMScript.Global.String - Username.

getVariable(String)

Returns the value in the global environment (used for communication between the script the calling context).
Returns: CRMScript.Global.String - The value of the variable.

getVariables()

Returns a map containing all run time environment variables (available through getVariable()).
Returns: CRMScript.Native.Map - All run time environment variables.

getWarnings()

Returns a map of the current system warnings.
Returns: CRMScript.Native.Map - The current system warnings.
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.
Returns: CRMScript.Global.String - A textual version of the HTML text.

idToLang(Integer)

Returns the code of the given language ID.
Returns: CRMScript.Global.String - Language code of the given language Id.

installPackage(String)

Installs a package provided as xml.
Returns: CRMScript.Global.String - Empty if no error, otherwise an error message.

invoiceTypesExists()

Checks if invoice types exist in the database.
Returns: CRMScript.Global.Bool - True if there are invoice types; otherwise, False.

isValidPhoneNumber(String,Bool)

Validates if it is a valid phonenumber
Returns: CRMScript.Global.Bool - True if valid phone number; otherwise, false.

langToId(String)

Returns the ID of the given language code.
Returns: CRMScript.Global.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”.
Returns: CRMScript.Global.Void

logMessage(String)

Writes a message to the log file.
Returns: CRMScript.Global.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.
Returns: CRMScript.Global.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.
Returns: CRMScript.Global.String - A random password of the given length.

mapValue(String)

Allocates a new map and maps the given value to the string “value”.
Returns: CRMScript.Native.Map - A map containing the value.

modulo(Integer,Integer)

Returns a modulo b. This can also be done with the syntax “a % b”.
Returns: CRMScript.Global.Integer - The result of a modulo b.

parseJSON(String)

Parses a JSON document and generate a tree of XMLNode’s.
Returns: CRMScript.Native.XMLNode
This function has a bug. Empty arrays will still return one child. We recommend using <code>parseJSON2()</code> instead where this bug has been fixed. Except for the fix, the function is identical. It is available from 8.4R03.
Example:

parseJSON2(String)

Parses a JSON document and generate a tree of XMLNode’s.
Returns: CRMScript.Native.XMLNode Example:

parseXML(String)

Parses an XML document and generate a tree of XMLNode’s.
Returns: CRMScript.Native.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.
Returns: CRMScript.Global.Integer - The current pause level after process this call.

pow()

The pow function returns base raised to the expth power.
Returns: CRMScript.Global.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. Prints the string to the screen.
Returns: CRMScript.Global.Void
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.
Returns: CRMScript.Global.Void

printBinary(NSStream)

Outputs the bytes to the standard output stream. You can pass the data to encode as either Byte[] or NSStream.
Returns: CRMScript.Global.Void

printDebug(String)

Adds the input debug to the debug string which will be shown in the debug window.
Returns: CRMScript.Global.Void

printLine(String)

Prints lines into standard output without appending \r
in p_line.
Returns: CRMScript.Global.Void

rand(Integer,Integer)

Returns a random value between min and max. The seed is set by the cgi application when it is invoked.
Returns: CRMScript.Global.Integer - A random value min <= r <= max.

reloadAndSendShipment(Integer)

Reloads mailings selections and schedule to send again immediately.
Returns: CRMScript.Global.Bool - True if it worked; False if it did not work, because the mailing was in an illegal state for this operation.
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
Returns: CRMScript.Global.Void
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.
Returns: CRMScript.Global.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.
Returns: CRMScript.Global.Void
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.
Returns: CRMScript.Global.String
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.
Returns: CRMScript.Global.String
The owner of the process running the CRMScript needs permissions to execute the program.

saveAllCgiAttachments(String)

Saves all cgi attachments with the given name.
Returns: CRMScript.Global.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.
Returns: CRMScript.Global.Integer - The ID of the saved attachment.

setChatStatus(Integer,Integer)

Changes the status of a chat session.
Returns: CRMScript.Global.Void
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.
Returns: CRMScript.Global.Void
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.
Returns: CRMScript.Global.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.
Returns: CRMScript.Global.Void
This function allows one to force this element initialization in the script, so that values may be accessed.n

setGlobalVariable(String,String)

Sets the value of a global variable (used for communication between different scripts).
Returns: CRMScript.Global.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.
Returns: CRMScript.Global.Void

setPageFocusFirstControl(Bool)

Used to set focus to first control in screens.
Returns: CRMScript.Global.Void

setPageOnLoad(String)

Void setPageOnLoad(String onLoad)
Returns: CRMScript.Global.Void

setPageRefresh(Integer)

Sets the page meta refresh to the specified seconds, thus making the screen refresh.
Returns: CRMScript.Global.Void
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.
Returns: CRMScript.Global.Void

setParserVariable(String,String)

Sets (adds) a variable to the global Parser instance.
Returns: CRMScript.Global.Void

setSessionVariable(String,String)

Writes a SessionObject entry to the databaseWrites a SessionObject entry to the database.
Returns: CRMScript.Global.String
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.
Returns: CRMScript.Global.Void

setVariable(String,String)

Sets the value in the global environment (used for communication between the script the calling context).
Returns: CRMScript.Global.Void

simpleTwoWay(Byte[])

Simple two-way data encryption. Data -> Encrypted data -> data
Returns: CRMScript.Global.Byte[] - Byte array with encrypted/decrypted data.

sleep()

Sleeps (give up CPU) for some time.
Returns: CRMScript.Global.Void
Useful in some CPU-intensive loops to maintain a responsive system.
Example:

getTypeName(Generic)

Returns the type of a variable (will automatically be up-casted to generic).
Returns: CRMScript.Global.String - The name of the type as a String. Example:

getGenericValue(Generic, String)

Returns a variable from the run-time environment given its name and independent of its type.
Returns: CRMScript.Native.Generic - The variable as a Generic, independent of its type.
An exception is thrown if the name is unknown, or the struct is not a struct.
Example:

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.
Returns: CRMScript.Native.Generic - The variable as a Generic, independent of its type.
An exception is thrown if the name is unknown, or the struct is not a struct.
Example:

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.
Returns: CRMScript.Global.Bool - The variable as a Bool.
If the generic doesn’t 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.
Returns: CRMScript.Global.Integer - The variable as an Integer.
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.
Returns: CRMScript.Global.Float - The variable as a Float.
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.
Returns: CRMScript.Global.String - The variable as a String.
If the generic does not represent the correct type, an exception is thrown.

convertGenericToString(Generic)

Returns the string representation of a variable. The argument is automatically be up-casted to a Generic.
Returns: CRMScript.Global.String - The string representation of the value in the Generic.
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.
Example:

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.
Returns: CRMScript.Global.Void
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.

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.
Returns: CRMScript.Global.Date - The variable as a Date.
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.
Returns: CRMScript.Global.DateTime - The variable as a DateTime.
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.
Returns: CRMScript.Global.Time - The variable as a Time.
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.
Returns: CRMScript.Native.TimeSpan - The variable as a TimeSpan.
If the generic does not 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.
Returns: CRMScript.Global.Byte - The variable as a Byte.
If the generic doesn’t represent the correct type, an exception is thrown.

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.
Returns: CRMScript.Native.Generic[] - The variable as an array.
If the generic does not represent an array, an exception is thrown.

getTypeDimensions(Generic)

Returns the number of array dimensions for a variable. The argument is automatically up-casted to a Generic.
Returns: CRMScript.Global.Integer - Number of dimensions.
This is the number of dimensions in, not the length of, the array!
Example:

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.
Returns: CRMScript.Global.Bool - True if the variable is a struct. Example:

getStructMembers(String)

Returns the variable names of a struct given its name. It does not includes functions in the list.
Returns: CRMScript.Global.String[] - String array of member names.
This is the names, not the actual values. To get those, call getGenericValue() using the member names.