openFrameAPI - Client
-
- UpdatedJan 30, 2025
- 25 minutes to read
- Yokohama
- API reference
The openFrameAPI provides methods that interact with OpenFrame. OpenFrame is an omni-present frame that communication partners can use to integrate their systems into the ServiceNow platform.
One of the core requirements is the ability to connect and serve code from different domains that can connect seamlessly with partner subsystems. This cross domain connection is required to keep connections and callbacks registered into communication systems without any cross domain issues.
openFrameAPI - getAWAAgentPresence(String success, String failure)
Returns the logged in agent’s current presence state.
Name | Type | Description |
---|---|---|
success | String | If the method is successful, name of the callback function to invoke. |
failure | String | If the method fails, name of the callback function to invoke. |
Example
The following code example shows how to call this method.
Response to success callback function:
openFrameAPI - hide()
Hides the OpenFrame in the TopFrame.
Name | Type | Description |
---|---|---|
None |
Type | Description |
---|---|
void |
Example
openFrameAPI - init(Object config, function successCallback, function failureCallback)
Initializes OpenFrame. This must be the first method that you call.
This method initializes communication to TopFrame and initializes any visual elements passed in the config parameter.
Name | Type | Description |
---|---|---|
config | Object | Name-value pairs to use during the initialization process. Possible keys: All keys are optional. Pass an empty object if you don't want to set these key-value pairs.
|
successCallback | function | Name of the callback function to use if the init method succeeds. The OpenFrame configuration stored in the system is passed as a parameter to the callback function. |
failureCallback | function | Name of the callback function to use if the init method fails. |
Type | Description |
---|---|
void |
Example
openFrameAPI - isVisible(function callback)
Checks to see if the OpenFrame is visible in the TopFrame.
Name | Type | Description |
---|---|---|
callback | function | The callback function receives a parameter with a value of true or false. True if OpenFrame is visible and false if not visible. |
Type | Description |
---|---|
void |
Example
openFrameAPI - openCustomURL(String details)
Opens a custom URL in the UI16 interface.
Name | Type | Description |
---|---|---|
Url | String | Text of the custom URL. Maximum size: 2083 characters |
Type | Description |
---|---|
void |
Example
openFrameAPI - openServiceNowForm(Object details)
Opens a form URL.
- In the platform interface, this API opens a form URL in TopFrame.
- For Agent Workspace, this API supports interaction tab management. In Agent Workspace, an interaction record opens in a parent tab and the specified entity record opens in a child tab under the interaction tab.
Type | Description |
---|---|
void |
Example
The following example shows basic usage in platform:
Example
The following example shows how to use the query parameter to create a new record with data provided in the form by using sysparm_query and an encoded query to populate the first and last name fields in Workspace:
openFrameAPI - openServiceNowFormwithChildTab()
Opens a ServiceNow form with a child tab if invoked in a workspace or opens an entity if invoked in the UI16 interface.
Type | Description |
---|---|
None |
Example
The following example opens the parent entity as a parent tab on a configured workspace, or opens just the entity if invoked in UI16.
openFrameAPI - openServiceNowList(Object details)
Opens a list URL in the UI16 interface.
Name | Type | Description |
---|---|---|
details | Object | Key value pairs that describe the content to use when opening the list URL. Valid values:
|
Type | Description |
---|---|
void |
Example
openFrameAPI - setFrameMode(mode)
Sets the OpenFrame mode.
- Sets the appropriate icon in the header: collapse or expand
- Raises the relevant event for CTI:
- openFrameAPI.EVENTS.COLLAPSE
- openFrameAPI.EVENTS.EXPAND
Name | Type | Description |
---|---|---|
Mode | String | Set OpenFrame Mode. Enumerated options:
|
Type | Description |
---|---|
void |
Example
openFrameAPI - setHeight(height)
Sets the OpenFrame height.
Name | Type | Description |
---|---|---|
Height | Number | Height in pixels |
Type | Description |
---|---|
void |
Example
openFrameAPI - setICContext(String Type, Object <Context>)
Sets the context data related to the interaction controls on the client. Use this context data to determine the client UI to display in OpenFrame.
For additional information on interactive controls, see Interaction Controls Component.
For additional information on interaction records, see CSM voice interaction record page.
Type | Description |
---|---|
None |
Example
The following code example shows how to set the active state context.
Example
The following example shows how to set the idle state context.
Example
The following example shows how to set the search target list context.
openFrameAPI - setIcons(Array icons)
Defines icons in the OpenFrame header that are placed next to the close icon.
Name | Type | Description |
---|---|---|
icons | Array of objects | A list of icon configurations, where each icon configuration is an object with key values imageURL, imageTitle, and any other needed context. Maximum size: Icons can be a maximum of 16x16 pixels. Larger images are automatically adjusted to this maximum. |
Type | Description |
---|---|
void |
Example
openFrameAPI - setPresenceIndicator(presence)
Sets the presence indicator to display agent availability in a workspace.
For more information on configuring OpenFrame, refer to Create an OpenFrame configuration
Name | Type | Description |
---|---|---|
state | String | Presence state of the agent. Default states:
You can also specify custom states. |
color | String | Presence indicator color on workspace. Supported colors:
|
Type | Description |
---|---|
void |
Example
openFrameAPI - setSize(Number width, Number height)
Sets the OpenFrame size.
Name | Type | Description |
---|---|---|
width | Number | Should be greater than zero. |
height | Number | Should be greater than zero. |
Type | Description |
---|---|
void |
Example
openFrameAPI - setSubtitle(String subTitle)
Sets the OpenFrame subtitle.
Name | Type | Description |
---|---|---|
subTitle | String | A string of 256 or fewer characters. |
Type | Description |
---|---|
void |
Example
openFrameAPI - setTitle(String title)
Sets the OpenFrame title.
Name | Type | Description |
---|---|---|
title | String | A string of 256 or fewer characters. |
Type | Description |
---|---|
void |
Example
openFrameAPI - setTitleIcon(Object icon)
Sets the OpenFrame's title icon.
Name | Type | Description |
---|---|---|
icon | Object | Object of key value pairs. Keys include imageURL, imageTitle, and any other context needed. Maximum size: Icons can be a maximum of 16x16 pixels. Larger images are automatically adjusted to this maximum. |
Type | Description |
---|---|
void |
Example
Example
openFrameAPI - setWidth(width)
Sets the OpenFrame width.
Name | Type | Description |
---|---|---|
Width | Number | Width in pixels |
Type | Description |
---|---|
void |
Example
openFrameAPI - show()
Makes the OpenFrame visible in the TopFrame.
Name | Type | Description |
---|---|---|
None |
Type | Description |
---|---|
void |
Example
openFrameAPI - subscribe(openFrameAPIEVENT event, function eventCallback)
Subscribes to a specified event.
Name | Type | Description |
---|---|---|
event | openFrameAPIEVENT | The event to subscribe to:
|
eventCallback | function | Function to call when the specified event occurs. |
Example
The following code example shows how to call this method for an openframe_awa_agent_presence
event.
Output:
Example
The following code example shows how to call this method for an openframe_awa_workitem_accepted
event.
Output:
Example
The following code example shows how to call this method for an openframe_awa_workitem_rejected
event.
Output:
openFrameAPI - version()
Returns the OpenFrame API version.
Name | Type | Description |
---|---|---|
None |
Type | Description |
---|---|
String | The OpenFrame API version |
Example
On this page
- openFrameAPI - getAWAAgentPresence(String success, String failure)
- openFrameAPI - hide()
- openFrameAPI - init(Object config, function successCallback, function
failureCallback)
- openFrameAPI - isVisible(function callback)
- openFrameAPI - openCustomURL(String details)
- openFrameAPI - openServiceNowForm(Object details)
- openFrameAPI - openServiceNowFormwithChildTab()
- openFrameAPI - openServiceNowList(Object details)
- openFrameAPI - setFrameMode(mode)
- openFrameAPI - setHeight(height)
- openFrameAPI - setICContext(String Type, Object <Context>)
- openFrameAPI - setIcons(Array icons)
- openFrameAPI - setPresenceIndicator(presence)
- openFrameAPI - setSize(Number width, Number height)
- openFrameAPI - setSubtitle(String subTitle)
- openFrameAPI - setTitle(String title)
- openFrameAPI - setTitleIcon(Object icon)
- openFrameAPI - setWidth(width)
- openFrameAPI - show()
- openFrameAPI - subscribe(openFrameAPIEVENT event, function eventCallback)
- openFrameAPI - version()