Embedded widgets
-
- UpdatedAug 1, 2024
- 3 minutes to read
- Xanadu
- Service Portal Designer
Embed a widget in the HTML template, server script, or client script.
Embed a widget in an HTML template
<widget></widget>
element to embed a widget in an HTML
template. Pass in the ID of the widget you are trying to embed as a
parameter.- HTML template
- Server script
Embed a widget in a client script
When using the spUtil class in a widget client script, you must inject the class into the client script function. The following example embeds the Cool Clock widget:
- Client script
- HTML template
Embed a widget in a server script
The following example embeds the Cool Clock widget:
- Server script
- HTML template
Widget model properties
When a widget model is called from within another widget, the HTML template, client script, and link function are loaded just as they are in the sp_widget record. The data property is the result of the widget server script execution. Anything that you put on the data object on the server is available in the data object on the client.
Embed a widget multiple times with custom options
Embed the cool clock widget multiple times using custom options.
Before you begin
Role required: admin or sp_admin
About this task
Create a widget that embeds multiple instances of the cool clock widget, each with a different time zone and title. Open the cool clock widget in the Widget Editor to see widget options referenced in the HTML template and the Client Script.

Procedure
Result
Each instance of the clock in the embedded clock widget appears with a different time zone.
