ObjectGears Help

Forum   ObjectGears (Version:

User messages from scripts

Sometimes it is necessary to pass a message to the user within the script run informing e.g. about creation of a request or about not meeting certain conditions for request saving. Furthermore, these messages have to be localized - offer to users message version corresponding to their language settings.

In order that these messages do not need to be stored in particular scripts and always found out which language message shall be presented to the user, IT owner of the model can create message, define its language versions and then call the message code by means of the function OG.MessageLoc.GetText. This function will return corresponding language version of the message. The advantage is centralization of messages and their possible modification without the need to change a script.

Each message contains code, language version and message text. Each message has to be defined first without language version. This message will be used if the user does not have set language for application or if there is no message version in his language. After that it is possible to create messages for particular language versions, that will have same code and will differ in language version.

These messages may be used together with object OG.Form to create pop up messages and replace parameter message of methods SetInfo, SetError and SetSuccess by this function.



If we want to pass the user an infomation saying that his request was submited for approval, we will create a message with code 'request_was_submitted'.

Then we will use a command in the script:

OGForm.SetSuccess( OG.MessageLoc.GetText( OGModel.Id, 'request_was_submitted'));

The user will then get a message. (In the mentioned example it is a default message, that is returned to a user without defined language for application or with another language than German or Czech.)

This website is using cookies files to provide services and analyse visits. You agree with that by using this website.     Further information