- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2017 07:08 AM
New to Jelly Scripting and would really appreciate help!
In my cart layout, I have added a new Widget Macro to Item Ordering Widget to display a custom field in my catalog item table called Delivery Standard. The script below is working (with help from SN). I need the label of this field to display based on the user's language.
When I created the new field, I edited the label properties and added French so that when a French user logs in, they see "Norme de livraison" for the field.
How do I refer to this field label below, if I don't want to hardcode the French and English label values?
Conversely, if I had to get the current user's language preference and write code to check that first and then display the html accordingly, how do I get the current user's language preference (ie. I can write a g:evaluate, but what do I put in my set to pass to my evaluate)?
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<j:set var="jvar_id" value="${jvar_cat_item.getID();}" />
<g:evaluate var="jvar_delivery_standard" jelly="true" expression="
var itemGr = new GlideRecord('sc_cat_item');
itemGr.get(jelly.jvar_id);
itemGr.u_delivery_standard;
" />
<j:if test="${jvar_delivery_standard > 0}">
<tr>
<td id="sc_delivery_time_label_cell"><strong>Delivery Standard</strong></td>
<td id="sc_delivery_time_cell">${jvar_delivery_standard}</td>
</tr>
</j:if>
</j:jelly>
Very grateful for any help that can be provided!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2017 07:16 AM
You can try using the gs.getMessage functionality:
http://wiki.servicenow.com/index.php?title=GlideSystem#getMessage.28String.2C_Object.29&gsc.tab=0
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2017 07:59 AM
I did find where the value is in the Field Labels table (sys_documentation) and does have both a French and English entry... but if anyone has any other suggestions on how to get this translated value to show up from my Jelly Script, I would appreciate it!
Thanks!