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)