
- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
on 03-05-2021 05:22 AM
- The catalog item itself doesn't make the distinction between Desktop and the Now Mobile app - it treats both as the same (Desktop Only = Desktop and the Now Mobile App)
- The function to return true/false is located on the server side in the GlideSystem API (gs.isMobile())
- We need to use GlideAjax in order to bridge the front end and back end- you can see the script include / catalog client script source code below.
- Either add your show/hide logic in the onLoad() script where indicated, or use g_scratchpad elsewhere in onChange scripts.
- Working with Quebec, but this should apply to earlier releases as well
Source:
(Client Callable Script Include)
var determine_if_mobile = Class.create();
determine_if_mobile.prototype = Object.extendsObject(global.AbstractAjaxProcessor, {
am_i_mobile: function(){
return gs.isMobile();
},
type: 'determine_if_mobile'
});
(Catalog Client Script)
function onLoad() {
//makes a glideAjax call to find out if we're in the mobile app
var ga = new GlideAjax('determine_if_mobile');
ga.addParam('sysparm_name', 'am_i_mobile');
ga.getXML(parseMyResponse);
function parseMyResponse(serverResponse) {
var answer = serverResponse.responseXML.documentElement.getAttribute("answer");
if (answer=='false') {
g_scratchpad.mobileapp = false;
// add show/hide logic here
}
else {
g_scratchpad.mobileapp = true;
// add show/hide logic here
}
}
}
(Code provided without warranty and was used for demo purposes only - add error handling and be sure to test thoroughly)
- 1,488 Views
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
I know this is old, but I am seeing an issue on Task where the Variables, which have no data, do not show on the Catalog Task in the Agent app. Out of the box, it shows the "requested item variables", but I have changed that to just "variables" since that screen is on the catalog task table. Well...it will show variables that have data in them, but not variables with no data (including mandatory fields which are blank on the task).
How can you get a catalog task in the mobile agent app to show the variables in the same way that you can see them in the instance in your browser? Looks great in the browser, but in the mobile app...Task do not look the same with variables missing when they aren't populated with data.