AgileApps Support Wiki Pre Release

Difference between revisions of "Functions.showMessage"

From AgileApps Support Wiki
imported>Aeric
imported>Aeric
Line 26: Line 26:
|args || string || Optional. Causes the first parameter to be treated as a key.
|args || string || Optional. Causes the first parameter to be treated as a key.
Declares an array of Strings in Java (or Arguments)  
Declares an array of Strings in Java (or Arguments)  
*If no additional arguments are passed, the message-string is displayed.
*If no additional arguments are passed, the original key (the message string) is displayed.
*If arguments are passed, the call expects a token. The platform then translates the token and displays the [[Custom Label]] in the selected language.
*If arguments are passed, the key is used to retrieve a [[Custom Label]] in the current language, with the supplied arguments injected into it.
|}
|}


Line 36: Line 36:


;Return:
;Return:
:*Returns the localized message configured on the key in the [[Translation Workbench]]
:*Returns the localized message configured on the key in the [[Translation Workbench]].
:*If no key is configured in the translation workbench, then the passed key (in other words, the message) is returned
:*If no key is configured in the translation workbench, then the passed key is returned.
<noinclude>
<noinclude>


[[Category:Utility]]
[[Category:Utility]]
</noinclude>
</noinclude>

Revision as of 01:33, 14 March 2014

Description

This function displays a message to the user, either at the top of page or in a dialog, depending on the context, using the Java API.

  • The basic version of the function displays a message string.
  • With additional options, a localized version of a message can displayed.
Considerations
  • The function displays the message in the UI, irrespective of any database insertions or updates (in other words, without interrupting the program flow).
  • In a JSP page, this function does nothing. Use a JavaScript alert(), instead.
Syntax
<syntaxhighlight lang="java" enclose="div">

void Functions.showMessage(String message); void Functions.showMessage(String key, String[] args); </syntaxhighlight>

To display a localized message:

Element Display Type Description
key string

A category name, followed by '.' and a message or label identifier (a "token").
Example: #categoryname.tokenname

args string Optional. Causes the first parameter to be treated as a key.

Declares an array of Strings in Java (or Arguments)

  • If no additional arguments are passed, the original key (the message string) is displayed.
  • If arguments are passed, the key is used to retrieve a Custom Label in the current language, with the supplied arguments injected into it.

To provide a key for a label that has no arguments (for example, for a label in the #custom category), use:

<syntaxhighlight lang="java" enclose="div">

Functions.showMessage("#custom.label", null) </syntaxhighlight>

Return
  • Returns the localized message configured on the key in the Translation Workbench.
  • If no key is configured in the translation workbench, then the passed key is returned.