GetMessageText

You can use this function for Optiva Workflows.

Purpose

This function returns the message text, for a message code, in the appropriate language and is determined by the optional input parameter, cultureName.

Syntax

int GetMessageText(string messageCode, ref string messageText, string cultureName = "")

Return Value

If the code is successful, a message code is found and a return value one (1) is displayed and minus one (-1) if failed.
Note: The return parameter is an integer.

Arguments

Part Description
messageCode The message code needs to be specified.
messageText The message text for the code that you specified is returned.
cultureName The language code needs to be specified for displaying the message text; if left empty, the message is returned in the users 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)

Example 1:

string msgJapanese = "";
	 GetMessageText("ITEMNOTFOUND", ref msgJapanese, "JA-JP");

Example 2:

string msg = "";
	 GetMessageText("FORMULACALCFAILED", ref msg);

Syntax

Function GetMessageTextEx(messageCode, cultureName, params token)

Arguments

Part Description
messageCode Input parameter. The message need to be specified.
cultureName Input parameter. The language code needs to be specified for displaying the message text; if left empty, the message is returned in the user default language. For example, FR-FR.
tokens The input parameter is optional. 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)