Custom Device Messages and Multiple Language Installations
You can display messages to users in the Swift MEAP™ application to warn them that actions cannot be performed. For example, to check that an End Date field is greater that the Start Date, you can display a message notifying users why they cannot save the record.
You must use the melt://showAlert/ function to display a message to users, for example, as follows:
{window.location = "melt://showAlert/End Date must be greater than Start Date";}
Displaying a message in this way is acceptable, but it means that this message is only editable by going into the JavaScript code for a module, locating the message and changing it.
It also means that this message is displayed, regardless of the language that is installed on the mobile device.
Instead of embedding messages directly into the code, you can configure the code to display a device message instead. Device messages are stored in the same location in the Admin application, and you can change the device messages by switching the Swift MEAP™ Admin application to another language (using the Manage Config feature), and then editing or translating the message. In this way, you can set up a different message for each language that is installed.
To use a custom device message, you must place a dollar sign ($) after the show alert command, followed by the name of the device message that you want to display, for example, as follows:
{window.location = "melt://showAlert/$device.message.name";} Using this format, you can name the message as follows: {window.location = "melt://showAlert/$custom.end.greater.than.start";}
And then create a custom device message named custom.end.greater.than.start that will be called from the JavaScript code. You can name the device message anything using letters, numbers or the period symbol (.) in the device message string.
Spaces are not allowed in the message name.
When using multiple language installations, each piece of code must be consistent for all languages. You cannot have one piece of code for an English user (ENG) and another for a Spanish user (ESL).
For keyword fields, Swift MEAP™ uses the underlying value written to the data source. If your installation uses Language Independent Codes for keywords so that the actual value written to data source is the same for all languages regardless of the display label on mobile devices, then the code will work for all languages. However, if each language has a different Keyword Alias being written to data source, then you will have to code multiple OR queries to configure every language value.