Willem
Giga Sage
Giga Sage

Hide the Personalize list

Hide it based on role

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 System Properties > UI Properties.
  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

find_real_file.png

find_real_file.png

 

 

Replace the macro with the following:

In the line <j:if test="${ListProperties.getTable() != 'incident'}"> 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>

 

 

Comments
Balpreet_Kaur
Tera Contributor

Hey Willem,

Thank you for the above solution.
Could you please help me to hide list controls (3 lines) option in the list view for specific table.
And I wanted to hide list context menu as well.
I am sending you the screenshot I wanted to hide those options in my list view.list view.PNG

beycos
Tera Contributor

Hello Willem, 

Thank you for the solution. I’ve also updated the macro and hidden the "Personalize" list from some tables. However, as an admin, I’m unable to use the cog icon. Do you have any suggestions for this?

Regards and Thanks again 

Version history
Last update:
‎09-22-2020 11:15 AM
Updated by: