Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

Static Translation not working for UI page

ApurvaS
Tera Contributor

We have custom "On Hold" UI action on incident form which opens a pop-up through UI page to enter details, we tried adding ${} to texts and create entries in sys_ui_message table but static translation is not working.

Below is the HTML code snippet from UI page

<div>
            <label for="textarea" id="selectOptions">On Hold Reason</label>
            <p>
                <select name="onHold" id="onHoldReason" onchange="onHoldChoiceMandatory()" class="form-control">
                    <option value="noneValue" role="option">--None--</option>
                    <option value="awaitingCaller" role="option">Awaiting Caller</option>
                    <option value="awaitingVendor" role="option">Awaiting Vendor</option>
                    <option value="awaitingChange" role="option">Awaiting Change</option>

                    <j:if test="${jvar_showUserOffboarding}">
                        <option value="userOffboarding" role="option">User Offboarding</option>
                    </j:if>
                </select>
            </p>
        </div>

 

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron

@ApurvaS 

this worked for me.

See this and enhance

<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
    <div>
        <g:evaluate jelly="true">
            var messages = {
            'user_offboarding': gs.getMessage('user.offboarding'),
            'awaiting_vendor': gs.getMessage('awaiting.vendor'),
            'awaiting_change': gs.getMessage('awaiting.change'),
            'awaiting_caller': gs.getMessage('awaiting.caller')
            }
        </g:evaluate>
        <select name="onHold" id="onHoldReason" onchange="onHoldChoiceMandatory()" class="form-control">
            <option value="noneValue" role="option">--None--</option>
            <option value="awaitingCaller" role="option">${messages.awaiting_caller}</option>
            <option value="awaitingVendor" role="option">${messages.awaiting_vendor}</option>
            <option value="awaitingChange" role="option">${messages.awaiting_change}</option>
            <option value="userOffboarding" role="option">${messages.user_offboarding}</option>
        </select>
    </div>
</j:jelly>

Messages

AnkurBawiskar_0-1773319341768.png

 

Output: choices shown in French

AnkurBawiskar_1-1773319341812.png

 

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

1 REPLY 1

Ankur Bawiskar
Tera Patron

@ApurvaS 

this worked for me.

See this and enhance

<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
    <div>
        <g:evaluate jelly="true">
            var messages = {
            'user_offboarding': gs.getMessage('user.offboarding'),
            'awaiting_vendor': gs.getMessage('awaiting.vendor'),
            'awaiting_change': gs.getMessage('awaiting.change'),
            'awaiting_caller': gs.getMessage('awaiting.caller')
            }
        </g:evaluate>
        <select name="onHold" id="onHoldReason" onchange="onHoldChoiceMandatory()" class="form-control">
            <option value="noneValue" role="option">--None--</option>
            <option value="awaitingCaller" role="option">${messages.awaiting_caller}</option>
            <option value="awaitingVendor" role="option">${messages.awaiting_vendor}</option>
            <option value="awaitingChange" role="option">${messages.awaiting_change}</option>
            <option value="userOffboarding" role="option">${messages.user_offboarding}</option>
        </select>
    </div>
</j:jelly>

Messages

AnkurBawiskar_0-1773319341768.png

 

Output: choices shown in French

AnkurBawiskar_1-1773319341812.png

 

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader