Why are client scripts not working in mobile agent?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-18-2019 01:39 PM
I have a client script to hide a choice value for a list field depending on the assignment group of a user. The script works fine on desktop but won't work for mobile agent (not classic mobile). I selected "All" for the UI type in the client script configuration and still no luck. I read that client scripts may not work for mobile agent, but I am not sure. If they do not work for agent, is there another way I can achieve this functionality? Client script code posted below:
function onLoad() {
//Type appropriate comment here, and begin script below
var assignmentGroup = g_form.getValue('graffiti_assignment_group');
if(assignmentGroup == '8b18132bdbec0050eb4700b5ca9619b4'){
// Do nothing
}
else{
// Remove RAB option
g_form.removeOption('resolution_code', 'RAB');
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-18-2019 09:14 PM
Hi there,
Did you check the UI Type? Is it set to mobile or to all? Also see:
https://docs.servicenow.com/bundle/newyork-mobile/page/administer/tablet-mobile-ui/task/t_EnableSmar...
If my answer helped you in any way, please then mark it as helpful.
Kind regards,
Mark
---
LinkedIn
Community article list
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-19-2019 05:19 AM
You are correct that client scripts won't run in the agent app. Sometimes validation can be added through actions and functions that run when a user swipes or hits a button in the app.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-19-2019 06:52 AM
Is it the same for NOW mobile app?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-19-2019 07:15 AM
Client scripting is not supported in either of the new mobile apps.
I'm not on the mobile team so let that be my disclaimer, but my understanding is that the new mobile studio and apps are built around short microexperiences rather than replicating the desktop experience on a mobile device. I think we've found that people generally use their mobile devices differently than a laptop or even a tablet where they're not filling out long forms, but want quick and easy ways to approve something, close a ticket, add a note, etc. Those types of things can be customized by using actions in mobile studio.