ian_kinnear
ServiceNow Employee
ServiceNow Employee

Scripts referenced in the video:

1. Scripted Data Item (returns media section records matching the Content Viewers value 'Employees accessing Agent' if users have no role assigned)

(function getQueryString(input) {
    //This script will return no rows if the user has roles, but will return a static media section row if the user is an employee and has no roles
    var queryString = '';
    var grCheck = new GlideRecord('sys_user_has_role');
    grCheck.addEncodedQuery('role!=7fcaa702933002009c8579b4f47ffbde^userDYNAMIC90d1921e5f510100a9ad2572f2b477fe^state=active');
    grCheck.query();
    if (grCheck.hasNext()) {
        queryString += "sys_id=-1^";
    } else {
        queryString += 'content_viewers=Employees accessing Agent^visibility=true';
    }
    queryString += "^ORDERBYorder";
    return queryString;
})(input);

2. System Property required to allow URL based redirection to another app (comma delimited string):

Name: glide.sg.allowed_external_deeplinks

Value: snrequest

3. Service Portal Widget client controller (for App store redirection):

api.controller = function() {
    /* widget controller */
    var c = this;
    var userAgent = navigator.userAgent || navigator.vendor || window.opera;
    if (/android/i.test(userAgent)) {
        window.location.href = "https://play.google.com/store/apps/details?id=com.servicenow.requestor";
    }

    if (/iPad|iPhone|iPod/.test(userAgent) && !window.MSStream) {
        window.location.href = "https://apps.apple.com/us/app/now-mobile/id1469616608";
    }
};

Version history
Last update:
‎07-13-2022 09:16 AM
Updated by: