Contents
Workspaces and UI Types
With Problem and Major Incident Management fully integrated into Service Operations Workspaces (SOW) in the Washington DC family release, there has never been a better time to migrate into the workspace. Migrating is well worth the effort but can be tricky. Any client scripts with a UI type of Desktop, custom of OOB, do not run in Configurable Workspaces (WEP) such as SOW. One such client script is the Planned Start Date onChange validation script used by Change Request.

Changing the UI Type to either Mobile / Service Portal or All will make this script run in WEP.

But beware: Some APIs used in classic UI are not supported when migrating your client scripts. For example, the validateStartDateBeforeEndDate()
function is not declared in the script, but rather a global UI script that also has a UI Type of Desktop

You may think, ‘Why not just change the UI type to All?
What about my globals?
Aside from the fact that UI Scripts work differently in WEP, as I explain in How to convert UI Scripts to run in Configurable Workspaces, WEP and its many globals, such as g_form()
are defined as completely different classes, with mostly the same, but sometimes different (and missing) methods. ServiceNow’s official documentation for Client API is not split between Classic UI and WEP despite being entirely a different JavaScript class, so it can be a little tricky to work out what is and is not supported. You may find some of your custom client scripts no longer work in WEP.
One could argue that some of these are not supported in the classic UI either, as many are not documented, but they are there and do not work in workspaces. One can argue the merits, but that is not the point of this article. I wish to list all the APIs available in the classic UI that are not supported (won’t work) in workspaces so that you can have a smoother migration. This list is not exclusive and may have missed some technically available but not supported API.
Known API Not supported in Workspaces
g_user_date_time_format
See How to Add moment.js to a Configurable Workspace (WEP) for alternatives.
g_form
activateTab()
addGlideUIElement()
addNameMapEntry()
addSecurityReadOnlyFields()
addValidator()
allChangedFieldsFilter()
changedFieldsFilter()
changeElementParent()
changeElementStyle()
clearAllFormMessages()
clearFormMessages()
disable()
disableMandatoryCheck()
enable()
enableMandatoryCheck()
enableOption()
enableUIPolicyFields()
fieldChanged()
findV2RelatedListName()
focusFirstVisibleField()
getAction()
getControlByForm()
getDerivedFields()
getDisplayBox()
getEncodedRecord()
getFieldNames()
getGlideUIElement()
getHelpTextControl()
getMissingFields()
getNiBox()
getOption()
getOptionControl()
getParameter()
getPrefixHandler()
getScope()
getSysId()
getTabNameForField()
getTitle()
hasAttribute()
hasFieldMsgs()
hasVariablesPrefix()
hideAllAnnotations()
isDatabaseView()
isDisabled()
isDisplayNone()
isFieldVisible()
isInteger()
isNumeric()
isSectionVisible()
isSecurityReadOnlyField()
isTemplateCompatible()
isUserPersonalizedField()
mandatoryCheck()
onSubmit()
registerHandler()
registerPrefixHandler()
removeAllDecorations()
removeContextItem()
removeCurrentPrefix()
removeItem()
removeVariablesPrefix()
resetPersonalizeHiddenFields()
resolveLabelNameMap()
resolveNameMap()
resolvePrettyNameMap()
serializeChanged()
serializeChangedAll()
serializeTargetFields()
setAction()
setDisabledControl()
setLiveUpdateOriginalValue()
setLiveUpdating()
setMandatoryOnlyIfModified()
setRequiredChecked()
setScope()
setSensitiveDisplayValue()
setStreamJournalFieldsDisplay()
setTemplateValue()
setUserDisplay()
setValidation()
triggerOnUserChangeValue()
GlideAjax
getXMLWait()
UI Scripts
UI scripts will no longer work. To learn how to migrate your UI Scripts, read my blog post How to convert UI Scripts to run in Configurable Workspaces
ValidateStartDateBeforeEndDate()
Change start date validation scripts will not work in the workspace. I explain how to use moment.js in a workspace in my blog post How to Add moment.js to a Configurable Workspace (WEP)
TLDR
- Some client-side API available in the classic UI is not supported in workspaces.
- This mostly impacts undocumented g_form API and UI Scripts.
- Take care when migrating your Client scripts.
- Avoid using undocumented API in the first place.
1 comment
Could you please help by converting or guiding the steps to use OOB UI script that is “validateStartDateBeforeEndDate()” in workspace too. We tried to create a Client script to run on Portal and included this UI script using ” g_ui_scripts.getUIScript(scriptName)..” as suggested in your article. Still facing issue and failing to load scripts.