- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-26-2025 11:55 PM
Hello All,
Can anyone please help me on the below requirement. I have written a business rule to set the set short description of the catalog item based on the few variables value.
In English version the short description is showing correctly but how to set this short description to japan langauge the japansese user will use this.
Can anyone please help how to achieve.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2025 02:57 AM
Hello @Mansi roy
Here is the updated script:
var shdesc = '';
var roles = [];
var entitlements = [];
var role_mrvs = JSON.parse(current.variables.required_roles);
var entitlement_mrvs = JSON.parse(current.variables.required_entitlement);
if (role_mrvs != '') {
for (var i = 0; i < role_mrvs.length; i++) {
var gr_role = new GlideRecord('u_oim_roles_list_new');
if (gr_role.get(role_mrvs[i].role)) {
roles.push(gr_role.u_role_name);
}
}
shdesc = gs.getMessage('For {0}: {1}: {2}', [
current.variables.user_id.getDisplayValue(),
current.variables.request_type.getDisplayValue(),
roles.toString()
]);
}
if (entitlement_mrvs != '') {
for (var j = 0; j < entitlement_mrvs.length; j++) {
var gr_entitlement = new GlideRecord('u_oim_single_entitelments');
if (gr_entitlement.get(entitlement_mrvs[j].entitlement_name)) {
entitlements.push(gr_entitlement.u_entitlementname);
}
}
shdesc = gs.getMessage('For {0}: {1}: {2}', [
current.variables.user_id.getDisplayValue(),
current.variables.request_type.getDisplayValue(),
entitlements.toString()
]);
}
// Update the short description
current.short_description = shdesc;
current.update();
- gs.getMessage() supports translation by replacing static strings with localized versions.
- In this case, phrases like 'For {0}: {1}: {2}' will be translated if corresponding keys exist in the system.
- Placeholders ({0}, {1}, {2}) are dynamically replaced with the provided values in the array.
- Add translations for 'For {0}: {1}: {2}' into your system's Messages table (sys_ui_message), with keys and their corresponding translations (e.g., Japanese).
Adding Translation Keys
- Navigate to System UI > Messages.
- Create a new message entry:
- Key: For {0}: {1}: {2}
- Message (Japanese translation): 対象 {0}: {1}: {2}.
- Repeat for any other keys or phrases used.
Hope this helps!
"If you found my answer helpful, please like and mark it as an "accepted solution". It helps future readers to locate the solution easily and supports the community!"
Thank You
Juhi Poddar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2025 12:05 AM
Hello Buddy, Can you please paste your code here?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2025 02:48 AM - edited 01-27-2025 02:49 AM
Hello @amitshishod ,
This short description i need to show in japanese language.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2025 02:57 AM
Hello @Mansi roy
Here is the updated script:
var shdesc = '';
var roles = [];
var entitlements = [];
var role_mrvs = JSON.parse(current.variables.required_roles);
var entitlement_mrvs = JSON.parse(current.variables.required_entitlement);
if (role_mrvs != '') {
for (var i = 0; i < role_mrvs.length; i++) {
var gr_role = new GlideRecord('u_oim_roles_list_new');
if (gr_role.get(role_mrvs[i].role)) {
roles.push(gr_role.u_role_name);
}
}
shdesc = gs.getMessage('For {0}: {1}: {2}', [
current.variables.user_id.getDisplayValue(),
current.variables.request_type.getDisplayValue(),
roles.toString()
]);
}
if (entitlement_mrvs != '') {
for (var j = 0; j < entitlement_mrvs.length; j++) {
var gr_entitlement = new GlideRecord('u_oim_single_entitelments');
if (gr_entitlement.get(entitlement_mrvs[j].entitlement_name)) {
entitlements.push(gr_entitlement.u_entitlementname);
}
}
shdesc = gs.getMessage('For {0}: {1}: {2}', [
current.variables.user_id.getDisplayValue(),
current.variables.request_type.getDisplayValue(),
entitlements.toString()
]);
}
// Update the short description
current.short_description = shdesc;
current.update();
- gs.getMessage() supports translation by replacing static strings with localized versions.
- In this case, phrases like 'For {0}: {1}: {2}' will be translated if corresponding keys exist in the system.
- Placeholders ({0}, {1}, {2}) are dynamically replaced with the provided values in the array.
- Add translations for 'For {0}: {1}: {2}' into your system's Messages table (sys_ui_message), with keys and their corresponding translations (e.g., Japanese).
Adding Translation Keys
- Navigate to System UI > Messages.
- Create a new message entry:
- Key: For {0}: {1}: {2}
- Message (Japanese translation): 対象 {0}: {1}: {2}.
- Repeat for any other keys or phrases used.
Hope this helps!
"If you found my answer helpful, please like and mark it as an "accepted solution". It helps future readers to locate the solution easily and supports the community!"
Thank You
Juhi Poddar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2025 01:06 AM