logo

NJP

Hide the Personalize list option for specific table

Import · Sep 22, 2020 · article

ServiceNow explains in the Docs that there is a property you can set, to restrict personalizing the list for a specific role.

It is explained in this Docs article how to do it:

https://docs.servicenow.com/bundle/paris-platform-administration/page/administer/list-administration...

  1. Navigate to .
  2. Locate the property labeled List of roles (comma-separated) that can use Personal Lists. If blank, all can use (glide.ui.list_mechanic.roles).
  3. Enter the roles for which personal lists are available, separated by commas, or leave the field blank to allow access for all users (default).

Hide it for specific table

To hide it for specific table you can modify the list_mechanic2 UI Macro:

yourinstance.service-now.com/nav_to.do?uri=sys_ui_macro.do?sys_id=c29ea314c0a80065699cd4bff4f6969c

Or

image

image

Replace the macro with the following:

In the line replace incident with the table you do not want to show the Gear Icon on.

To hide it from multiple tables, add to it like so:

<j:if test="${ListProperties.getTable() != 'incident' &amp;&amp; ListProperties.getTable() != 'sc_req_item' }">

The XML:

<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
                <j:if test="${ListProperties.hasListMechanic()}">
                    <!-- When glide.ui.related_list_mechanic property set to false, don't show list mechanic for related list-->
                    <g:set_if var="jvar_show_list_mechanic" test="${ListProperties.isRelatedList() == true &amp;&amp; gs.getProperty('glide.ui.related_list_mechanic', 'true') == 'false'}"
                    true="false"
                    false="true" />

                    <j:set var="jvar_dialog_title" value="${gs.getMessage('Personalize List Columns')}" />

                    <j:if test="${ListProperties.isUserList() == true}" >
                        <j:set var="jvar_gear_image" value="images/gear_customize.gifx"/>
                        <j:set var="jvar_gear_icon" value="icon-cog-changes btn btn-icon table-btn-lg"/>
                        <j:set var="jvar_gear_title" value="${gs.getMessage('Update Personalized List')}"/>
                    </j:if>
                    <j:if test="${ListProperties.isUserList() != true}" >
                        <j:set var="jvar_gear_image" value="images/gear.gifx?v=2"/>
                        <j:set var="jvar_gear_icon" value="icon-cog btn btn-icon table-btn-lg"/>
                        <j:set var="jvar_gear_title" value="${gs.getMessage('Personalize List')}"/>
                    </j:if>
                    <j:if test="${jvar_show_list_mechanic == true}">
                        <j:if test="${ListProperties.getTable() != 'incident'}">
                        <j:if test="${GlideMobileExtensions.getDeviceType() != 'doctype'}">
                            <a data-type="list_mechanic2_open"
                            data-list_id="$[sysparm_list_id]"
                            data-table='${ListProperties.getTable()}'
                            data-parent-id='$[ListProperties.getParentID()]'
                            data-parent-table='${ListProperties.getParentTable()}'
                            data-view='${JS,HTML:sysparm_view}'
                            data-relationship='${ListProperties.getRelationship()}'
                            data-title='${JS,HTML:jvar_dialog_title}'
                            role="button"
                            tabindex='0'>
                                <img src="${jvar_gear_image}"
                                alt="${JS,HTML:jvar_gear_title}"
                                title="${JS,HTML:jvar_gear_title}"/>
                            </a>
                        </j:if>
                        <j:if test="${GlideMobileExtensions.getDeviceType() == 'doctype'}">
                            <i data-type="list_mechanic2_open"
                            data-list_id="$[sysparm_list_id]"
                            data-table='${ListProperties.getTable()}'
                            data-parent-id='$[ListProperties.getParentID()]'
                            data-parent-table='${ListProperties.getParentTable()}'
                            data-view='${JS,HTML:sysparm_view}'
                            data-relationship='${ListProperties.getRelationship()}'
                            data-title='${JS,HTML:jvar_dialog_title}'
                            class="${jvar_gear_icon}"
                            title="${JS,HTML:jvar_gear_title}"
                            role="button"
                            tabindex='0'>
                                <span class="sr-only">
                                ${JS,HTML:jvar_gear_title}
                                </span>
                            </i>
                        </j:if>
                    </j:if>
                        </j:if>
                </j:if>
</j:jelly>

Below I have commented out the lines I have added:

<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
                <j:if test="${ListProperties.hasListMechanic()}">
                    <!-- When glide.ui.related_list_mechanic property set to false, don't show list mechanic for related list-->
                    <g:set_if var="jvar_show_list_mechanic" test="${ListProperties.isRelatedList() == true &amp;&amp; gs.getProperty('glide.ui.related_list_mechanic', 'true') == 'false'}"
                    true="false"
                    false="true" />

                    <j:set var="jvar_dialog_title" value="${gs.getMessage('Personalize List Columns')}" />

                    <j:if test="${ListProperties.isUserList() == true}" >
                        <j:set var="jvar_gear_image" value="images/gear_customize.gifx"/>
                        <j:set var="jvar_gear_icon" value="icon-cog-changes btn btn-icon table-btn-lg"/>
                        <j:set var="jvar_gear_title" value="${gs.getMessage('Update Personalized List')}"/>
                    </j:if>
                    <j:if test="${ListProperties.isUserList() != true}" >
                        <j:set var="jvar_gear_image" value="images/gear.gifx?v=2"/>
                        <j:set var="jvar_gear_icon" value="icon-cog btn btn-icon table-btn-lg"/>
                        <j:set var="jvar_gear_title" value="${gs.getMessage('Personalize List')}"/>
                    </j:if>
                    <j:if test="${jvar_show_list_mechanic == true}">
                        <!--j:if test="${ListProperties.getTable() != 'incident'}"-->
                        <j:if test="${GlideMobileExtensions.getDeviceType() != 'doctype'}">
                            <a data-type="list_mechanic2_open"
                            data-list_id="$[sysparm_list_id]"
                            data-table='${ListProperties.getTable()}'
                            data-parent-id='$[ListProperties.getParentID()]'
                            data-parent-table='${ListProperties.getParentTable()}'
                            data-view='${JS,HTML:sysparm_view}'
                            data-relationship='${ListProperties.getRelationship()}'
                            data-title='${JS,HTML:jvar_dialog_title}'
                            role="button"
                            tabindex='0'>
                                <img src="${jvar_gear_image}"
                                alt="${JS,HTML:jvar_gear_title}"
                                title="${JS,HTML:jvar_gear_title}"/>
                            </a>
                        </j:if>
                        <j:if test="${GlideMobileExtensions.getDeviceType() == 'doctype'}">
                            <i data-type="list_mechanic2_open"
                            data-list_id="$[sysparm_list_id]"
                            data-table='${ListProperties.getTable()}'
                            data-parent-id='$[ListProperties.getParentID()]'
                            data-parent-table='${ListProperties.getParentTable()}'
                            data-view='${JS,HTML:sysparm_view}'
                            data-relationship='${ListProperties.getRelationship()}'
                            data-title='${JS,HTML:jvar_dialog_title}'
                            class="${jvar_gear_icon}"
                            title="${JS,HTML:jvar_gear_title}"
                            role="button"
                            tabindex='0'>
                                <span class="sr-only">
                                ${JS,HTML:jvar_gear_title}
                                </span>
                            </i>
                        </j:if>
                    <!--/j:if-->
                        </j:if>
                </j:if>
</j:jelly>
View original source

https://www.servicenow.com/community/developer-articles/hide-the-personalize-list-option-for-specific-table/ta-p/2321036