GetMessageText

You can use this function for Optiva Workflows.

Purpose

Returns the message text, for a message code, in the appropriate language. The language is determined by the optional input parameter, cultureName.

Syntax

Function GetMessageText(messageCode As String, ByRef messageText As String, Optional cultureName As String = "") As Int32

The return parameter is an integer. If the messageCode is found, the return value is 1. If it is not found, the value is -1.

Arguments

Part Description
messageCode Input parameter. Specify a message code.
messageText Output parameter. Returns the message text for the code that you specified.
cultureName Optional input parameter. Specify the language and culture in which to display the message text. For example, FR-FR.

If you omit this parameter, the message text is displayed in the system default language.

Examples

To display the return code as an integer for the message in Japanese, use this syntax:

Function wf_start() As Long
Dim msgJapanese as string
Dim rtn as Int32 = GetMessageText("ITEMNOTFOUND", msgJapanese, "JA-JP")
MessageList("return for JA-JP: ", rtn)
End Function

To display the message text for FORMULACALCFAILED in the system default language, use this syntax:

Dim msg as string
GetMessageText("FORMULACALCFAILED", msg)
MessageList(msg)

To display the message text for FORMULACALCFAILED in a different language, add the optional parameter for the cultureName that you want displayed:

Dim msg as string
GetMessageText("FORMULACALCFAILED", msg, "FR-FR")
MessageList(msg)

To display the message text for FormulaCalcFailed in the local browser language, use this syntax:

Dim sLanguage as String = Context.SessionInfo.Language
Dim msg as String
Dim rtn as Int32 = GetMessageText("FORMULACALCFAILED", 
msg, sLanguage)
Messagelist("Language", sLanguage, "Message Code", msg)

Syntax

Function GetMessageTextEx(messageCode, cultureName, params token)

Arguments

Part Description
messageCode Input parameter. Specify a message code.
cultureName Input parameter. Specify the language and culture in which to display the message text. For example, FR-FR.

If you omit this parameter, the message text is displayed in the system default language.

tokens Optional input parameter. Specify additional values if required.

Examples

There are two options for retrieving message text, depending on the inclusion of tokens passed to the function.

Dim msg as String
    Msg = GetMessageTextEx("FORMULACALCFAILED", "", "Free Text Test", "More Text Here")
   Messagelist(msg)
Dim msg as string
Msg = GetMessageTextEx("FORMULACALCFAILED", "FR-FR", "Free Text Test", "More Text Here")
MessageList(msg)