How to call Script Include or external JS in UI Builder Client Script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2025 10:36 PM
Hi everyone,
In UI Builder, I’m trying to run some custom logic in a Client Script when a user inputs Japanese Kanji characters in a form field, and automatically convert them to Hiragana using the external JS library wanakana.js.
I have a few questions:
Should we use a regular Script Include or a UX Client Script Include if we want to use it inside a UI Builder Client Script?
How can we call a Script Include (like one that returns a Base64-encoded JS file from sys_attachment) inside a Client Script in UI Builder?
What is the correct approach to load and evaluate external JavaScript libraries (like wanakana.js) in this context?
I’ve already tried using eval(atob(...)) after retrieving the Base64 string, but the script doesn't seem to inject wanakana into the global scope.
Any working examples or best practices would be greatly appreciated! 🙏
Thanks in advance!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2025 12:45 PM
Hi @kack l,
If you're trying to call a Script Include from a UI Builder (UIB) client script, a standard Script Include won’t work directly. You’ll need to use a UX Client Script Include instead.
Here’s how you can set it up:
In UI Builder, scroll to the bottom-left section and go to Client Scripts.
Click the ➕ icon to add a new script, then navigate to Client Script Includes.
Select the UX Client Script Include you want to use.
To call it within your client script, you can use this pattern:
function handler({api, event, helpers, imports}) {
var result = imports['apiName']()(arguments);
}
Replace the 'apiName' with your UX client script include API name and If you want to pass any arguments to you script include you can pass them in comma separated manner like we pass it to function normally.
-----------------------------------------------------------------------------------------------------------------------------
Let me know if you need help with anything else!
If this helped, please mark it as Helpful and Accept as Solution.
Thanks & Regards
Mayank
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2025 11:42 PM
Hi @kack l,
-----------------------------------------------------------------------------------------------
Let me know if you need any further help or if your query already resolves Please mark my above response Helpful and Accept as solution,
Thanks & Regards
Mayank