PolarisUI - Scoped
The PolarisUI API provides methods for enabling Next Experience on direct UI pages.
A UI page [sys_ui_page] is direct if the Direct field is Selected. A direct UI page doesn't include the common HTML page template and must include all CSS and JavaScript that you want to use in the page.
All non-direct UI pages use Next Experience by default.
For more information about Next Experience, see the Next Experience UI.
The PolarisUI API is provided within the sn_ui
namespace.
PolarisUI - canUsePolarisCSS()
Checks if the current page can use the Next Experience UI.
true if all of the following conditions are met.- sn_ui.PolarisUI.isEnabled() is
true. - The request URL parameter sysparm_use_polaris is not set to
false. - The referrer HTTP request header does not contain
sysparm_use_polaris=false. - The page or its parent plugin are not denied use of Next Experience by a record in the Page Theme Support [sys_page_theme] table.
Use this method to conditionally change behavior or jelly output if Next Experience is enabled.
| Name | Type | Description |
|---|---|---|
| None |
| Type | Description |
|---|---|
| Boolean | Flag that indicates whether the current page can use the Next Experience UI. Valid values:
|
This UI Action redirects to a different page if Next Experience is running on the current form.
var id = current.getUniqueValue();
if (sn_ui.PolarisUI.canUsePolarisCSS())
action.setRedirectUrl("/now/custom/application/record/" + id);
return "/record.do?sys_id=" + id;
This jelly script sets a different style sheet for pages using Next Experience.
<g:evaluate var="jvar_css_path">
// Core UI content css record
var id = "5e8fde63d713310074304187ed61030d";
if (sn_ui.PolarisUI.canUsePolarisCSS())
id = "84f03cc87120a00cfab6dd207cb0b72";
"/" + id + ".cssdbx";
</g:evaluate>
<link href="${jvar_css_path}" rel="stylesheet" type="text/css" />
PolarisUI - getBodyClassNames()
Returns a list of CSS class names used by the Next Experience UI.
<body> tag of a UI page to set the CSS
classes required for Next Experience to render
correctly.<body class="$[sn_ui.PolarisUI.getBodyClassNames()]">The returned class names change depending on system properties and if session debug output exists.
| Name | Type | Description |
|---|---|---|
| None |
| Type | Description |
|---|---|
| String | List of CSS class names used by the Next Experience UI. |
This jelly script adds Next Experience to a custom UI page.
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="true" xmlns:j="jelly:core" xmlns:g="glide" xmlns:g2="null">
<g2:doctype name="html" />
<g:inline template="dir_checker.xml"/>
<html class="${jvar_text_direction}" lang="$[gs.getSession().getLanguage()]">
<head>
<g:inline template="set_theme_vars.xml" /> <!-- sets jvar_theme and jvar_css_cache_key -->
<g:requires name="styles/css_includes_my_app.css" includes="true" params="$[jvar_css_cache_key]" />
<g:if_polaris>
<g:then><g:inline template="polarisberg_output.xml"/></g:when>
<g:else><g:inline template="heisenberg_output.xml" type="css"/></g:else>
</g:if_polaris>
</head>
<body class="$[sn_ui.PolarisUI.getBodyClassNames()]">
Your UI page content here
</body>
</html>
</j:jelly>
PolarisUI - isEnabled()
Checks if the Next Experience UI is enabled for the current user.
- glide.ui.polaris.experience enables Next Experience on the instance.
- glide.ui.polaris.use disables Next Experience for specified users when set to false.
| Name | Type | Description |
|---|---|---|
| None |
| Type | Description |
|---|---|
| Boolean | Flag that indicates whether the Next Experience UI is enabled for the current user. Valid values:
|
This UI page displays a conditional message to the user if Next Experience is enabled for the current user.
<j:if test="${sn_ui.PolarisUI.isEnabled()}">
<a href="...">Click here to learn more about the new UI changes</a>
</j:if>
This business rule shows an info message on record display that a user can click to view
the record in Core UI instead of Next Experience. The business rule
Condition field is set to !current.isNewRecord() &&
sn_ui.PolarisUI.isEnabled() && sn_ui.PolarisUI.canUsePolarisCSS().
// business rule script field
(function executeRule(current, previous /*null when async*/) {
var sysId = current.getUniqueValue();
gs.addInfoMessage("<a href='/incident.do?sys_id="+ sysId +"&sysparm_use_polaris=false'>Click here to load this page in Core UI</a>");
})(current, previous);