Notifications

419 views

Controlling the '+' button | Mobile UI


Overview

The following article describes how to control the appearance of the + button in mobile UI lists using ACLs.

 

Description

The + button appears on the top-right corner of the screen in a list on the mobile UI:

Pressing the + button creates a new record in the list.

Sometimes you may need to restrict certain users from creating new records from the mobile UI, but still allow them to create new records from the desktop UI. Because this button is not one of the UI actions, but is hard coded in the UI code, we cannot create conditions directly on the button.

 

Steps to implement

To control the + button in the mobile UI, create an ACL to restrict the mobile UI:

  1. Create an access control using the following information:
    • Type: Record
    • Operation: Create
    • Name:  Use the name of the table you want to restrict, for example, Incident
    • Active: Checked
    • Advanced: Checked
  2. Enter the following code in the Script field:
    • if(GlideTransaction.get().getPageName() != "angular") { answer = false; } else { answer = true; }

  3. Click Save.

The script in step 2 obtains the name of the page and checks to see if it is called "angular" (the name of the page in the mobile UI). When it checks the name, one of the following occurs:

  • If it is not angular, it is not mobile and the ACL passes
  • If it is angular, it is in mobile, the ACL restricts access, and the + button is not displayed

Note that while this does function, it is not an official solution. The name used for the mobile page may change in future versions. If this fix is implemented, be sure to test after upgrades to ensure you are seeing the expected behavior.

Article Information

Last Updated:2018-01-24 06:23:31
Published:2018-01-24