A number of JQuery and Angular API calls and global variables are not supported in client script code which runs as part of the Service Portal, or in the Mobile UI. Trying to use them in Client Scripts where the UI Type is not "Desktop" will result in run time errors.
Understand which Client Scripts will run as part of the Service Portal user interface, and which APIs are available in each case. Remove any unsupported API calls from your code.
Time to fix