- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
When you move to Service Portal, there is a possibility that the client scripts defined on catalog items and record producers do not work on Service Portal. The reason is that Service Portal is a mobile framework and when you created the scripts on platform few months or years ago you didn't consider if the script should apply to mobile platform as well. If you were not using the ServiceNow native mobile app, then it is more likely to happen. The good news is that you don't have to write more code in your client scripts to make it compatible for Service Portal, it is just a simple configuration change.
What to do when Catalog Client Scripts do not work on Service Portal
You need to go back to the definition of client script and make it available for Mobile or both Desktop and Mobile. Yes, it's that simple. Follow the steps below, and keep in mind that in some older versions the selection options will be different.
- Navigate to Maintain Items in the Filter Navigator and select the catalog item where you defined the client script.
- Click on the options button (hamburger icon) and select Configure > Client scripts.
- On the definition of catalog client script, you need to change the value of field: "UI Type" to either "All" (if using both platform and Service Portal) or "Mobile/Service Portal" (if using only Service Portal)
In some old versions, the value options may look like this. Either select "Both" (if using both platform and Service Portal) or "Mobile" (if using only Service Portal)
While you should make sure that the script is applicable on Mobile UI type, you must also make sure the script is compatible with the mobile scripting or Portal supported APIs.
You can use onLoad, onChange, and onSubmit client scripts.
- addDecoration(fieldName, icon, title)
- addErrorMessage(message)
- addInfoMessage(message)
- addOption(fieldName, value, label, index)
- clearMessages()
- clearOptions(fieldName)
- clearValue(fieldName)
- getActionName()
- getBooleanValue(fieldName)
- getDecimalValue(fieldName)
- getDisplayValue(fieldName)
- getEncodedRecord()
- getFieldNames()
Using Client Scripts on Variable Editors and Order Guides
Since we are on the Catalog client scripts, let me clarify one last thing. If you have selected the checkbox for "Applies on requested Item" or/and "Applied on catalog tasks" to make it work for Variable Editors, then you may run into an issue with the variable editor.
Unfortunately, it won't work on Service Portal because vEditor or default Variable Editor is not yet supported on Service Portal. We are working on it, appreciate your patience while we fix it 🙂
If you use Order Guides and do item variable assignments, that won't work on Service Portal. There will be huge changes in Service Catalog's default behavior on Service Portal in the next upcoming release, so stay tuned. I will definitely brag about it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.