- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
I'm really new to UI Builder and have a business requirement that I need help with.
Currently, in the core UI forms for catalog tasks (SCTASK), we have a UI Macro on the form that provides a list of consolidated work notes and user comments for the entire request so none get missed when fulfilling a request. The UI macro calls a script include that gathers the data based on two parameters passed - the SCTASK sysid and the RITM sysid.
I need the same functionality for Service Operations Workspace and I'm stuck on how to create a data resource to call the script include. I assume I can pass parameters to the data resource with a client state parameter or field value from the form controller, I just don't know how to do that in a data resource, or even what kind of data resource since I want to re-use the script include code.
Can someone help me out, please?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago - last edited 2 weeks ago
It turns out you can call a Script Include from UI Builder, and it was easy and did not require a catalog client script or REST API. It may not be efficient, but it works.
Here is how I did it:
Business requirement: Display a consolidate list of work notes and comments for a catalog task in the side bar of a standard record page that is open on a catalog task.
1. On the standard record page of the workspace I'm using, I created a new Transform data resource.
2. In the data resource, I wrote the script I needed to get the data. Once I had this working and it returned data, I
3. Copied the script into a new function in an existing Script Include that is client callable.
4. Changed the Transform to call the script include the same way you normally would. For those who are visual, this is what it looked like:
I still have to hook it up to the sidebar, add events to refresh data, limit it to only being used for a catalog task record, etc., but I have data!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @gjz ,
Follow this youtube video
https://www.youtube.com/watch?v=bXgN8_zBQ-I
If my response helped, mark it as helpful and accept the solution.
Regards.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago - last edited 2 weeks ago
This video is a copy of Brad Tilton's video, and they replaced the sound with music. I didn't find it helpful, but found the original from Brad that had his explanation - which was much more useful to me.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi! In Breaking Trail I have an article that covers something very similar to what you're looking for: Cómo llamar a un Script Include desde un Client Script de UI Builder | Breaking Trail
It walks through how to reuse your Script Include logic in UI Builder by setting up a Scripted REST Resource as an intermediary and calling it from your client code. The pattern handles parameter passing and response handling, which should help you solve your data resource challenge.
Give it a read — it might point you in the right direction for your implementation.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago
Is there an English version? Just looking at the code, it does seem like it is very helpful, but unfortunately for me I only speak one language.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi,
In UI Builder, you cannot directly call Script Includes like in classic UI. Instead, you should use Data Resources or GlideAjax (via client script).
Recommended Approach (Best Practice):
Use a Script Include + Data Resource (Server Script)
Steps:
- Create a Script Include:
var GetData = Class.create();
GetData.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getDetails: function() {
var gr = new GlideRecord('incident');
gr.query();
var result = [];
while (gr.next()) {
result.push({
number: gr.number.toString(),
short_description: gr.short_description.toString()
});
}
return JSON.stringify(result);
}
});
- In UI Builder:
- Add a Data Resource → Server Script
- Call the Script Include
- Bind the Data Resource to your component
Alternate (Client-side):
Use GlideAjax from a Client Script if needed.
Explanation:
UI Builder follows a data-driven architecture where Data Resources act as the bridge between UI and server logic.
Reference:
Hope this helps.
Please mark helpful/correct if it worked.
