- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-11-2024 09:04 AM - edited 01-11-2024 09:18 AM
Hi All,
I was going through one OOB Ui Action Script and noticed that they have getMessage as you can see in below picture. Why do we need getMessage here, why not just g_form.addErrorMessage().
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-11-2024 11:48 AM
Hi @Sachin G K1
As @Sandeep Rajput mentioned, if the key doesn't exist in the sys_ui_message table, then the key (first parameter in the getMessage() method) is displayed. If you want to add localization and translations to this value, then you can create this message and additional messages for each language as required and never have to update the script.
So circling back to your original question: 'Why do we need getMessage in below Script'
Answer: The getMessage method is simply used for localization and translation. When a client script contains a getMessage call or a server script contains a gs.getMessage call, the system checks the Message [sys_ui_message] table for translated text. If the Message [sys_ui_message] does not contain a matching value based on the 'key', the message displayed is as per the original script, and first parameter. In your case, Cannot propose major incident as 'Worknotes' is not visible.
To help others (or for me to help you more directly), please mark this response correct by clicking on Accept as Solution and/or Helpful.
Thanks, Robbie
Basically, if and when you add various language support to your instance, you don't need to change or maintain the code.
To help others (or for me to help you more directly), please mark this response correct by clicking on Accept as Solution and/or Helpful.
Thanks, Robbie
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-11-2024 09:14 AM
Hi @Sachin G K1,
This is simply about localization and translation. When a client script contains a getMessage call or a server script contains a gs.getMessage call, the system checks the Message [sys_ui_message] table for translated text.
Basically, if and when you add various language support to your instance, you don't need to change or maintain the code.
To help others (or for me to help you more directly), please mark this response correct by clicking on Accept as Solution and/or Helpful.
Thanks, Robbie
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-11-2024 09:20 AM - edited 01-11-2024 09:26 AM
okay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-11-2024 09:23 AM
Hi @Sachin G K1
This is the key:
Cannot propose major incident as 'Worknotes' is not visible
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-11-2024 09:27 AM
The key is the first parameter. So in the example you provided, the key is 'Cannot propose major incident as 'Worknotes' is not visible'.
To confirm this, go to the Message [sys_ui_message] table and look up the Message using the key.
To help others (or for me to help you more directly), please mark this response correct by clicking on Accept as Solution and/or Helpful.
Thanks, Robbie