Get a first look at what's coming. The Developer Passport Australia Release Preview kicks off March 12. Dive in! 

Hide subToolbar for Project Workspace

nowitsvashu
Tera Guru

Hi 

 

In project workspace there is a record page whenever from list i open any record Project Workspace Subtoolbar become visible there is a property of it in which i have mentioned my page id as well still its not working

nowitsvashu_0-1758944032004.png
Its working fine for my another page listtest.

Here is my subToolbar property snapshot

nowitsvashu_1-1758944104708.png

 

 

5 REPLIES 5

kaushal_snow
Giga Sage

Hi @nowitsvashu ,

 

You can hide the subToolbar (L2 menu) in Project Workspace by using the hideSubToolbar property in the UX Page Properties (adding the page route/name to the hideSubToolbar list) or by overriding the getPlannerSubPageItems method in ProjectWorkspaceHelper (copying from the OOB ProjectWorkspaceHelperSNC) to omit pushing that page menu entry...

 

If you found my response helpful, please mark it as ‘Accept as Solution’ and ‘Helpful’. This helps other community members find the right answer more easily and supports the community.

 

Thanks and Regards,
Kaushal Kumar Jha - ServiceNow Technical Consultant/Developer

Hi @kaushal_snow ,

 

Thank you for your reply.

 

I've already added my page in the hideSubToolbar property but its not working for record.

I don't know if you are still looking for the solution to this issue, but I have found the answer.

 

I had the same issue as you, and I found the solution while I was trying to find how to fix another problem I had with breadcrums, which were not working properly.

 

Breadcrums behaviour is controlled by "AppShellBreadcrumbItemsProvider " script include. In fact, one can define which script include is going to rule Breadcrums in table "sys_extension_instance".

 

I am explaining all of this because if we have a look inside this script include we find the following:

provideItems: function(context) {
        var output = {
            operation: 'REPLACE',
            items: [],
            routeInfo: {
                route: context.route,
                fields: context.fields,
                params: context.params
            }
        };
        var payload = this.getPayloadFromContext(context);
        switch (context.route) {
            case 'planner':
            case 'planning':
            case 'ridac-monitor':
            case 'analytics':
            case 'docs':
			case 'status-report':
            case 'pw-financials': (SOME MORE CODE)
            case 'home': (SOME MORE CODE)
            case 'record':
				if (context.params.pageName != "details") {
                    payload = this.getDisplayLabel(payload, context);
                    payload.operation = 'APPEND';
                    payload.hideBreadcrumb = false;
                    if (context.params && context.params.hideBreadcrumb === 'true')
                        payload.hideBreadcrumb = true;
                    if ((context.prevBreadcrumbRoute.route === "record" && context.route === "record" &&
                            context.prevSelectedContent.fields && context.prevSelectedContent.fields.table &&
                            context.prevSelectedContent.fields.table === context.fields.table &&
                            context.prevSelectedContent.fields.sysId && context.prevSelectedContent.fields.sysId === "-1"))
                        payload.operation = 'REPLACE_LAST_ITEM';
                    payload.subToolbarOptions = {
                        hideSubToolbar: false, //default will be true
                        viewportInfo: {
                            "route": "planner-menu",
                            "fields": {
                                projectSysId: "-1",
                                projectClass: "-1",
                                timeStamp: Date.now()
                            },
                            "params": {
                                pageName: context.params.pageName || 'details'
                            }
                        },
						defaultDividerPosition: 15,
						dividerStyles: {},
						"isExpanded": true,
						disabled: true,
						"rightPanelMinWidth": {
							"minRatio": 80,
							"minPixels": 100
						},
						"leftPanelMinWidth": {
							"minRatio": 20,
							"minPixels": 10
						},
						"displayDividerButton": true,
						"position": "center"
                    };
					if(context.params.hideMenu === 'true' || context.params.hideMenu === true) {
						payload.subToolbarOptions.hideSubToolbar = true;
						payload.subToolbarOptions.viewportInfo.fields.projectSysId = -1;
						payload.subToolbarOptions.viewportInfo.fields.projectClass = -1;
						payload.subToolbarOptions.viewportInfo.params.hideMenu = "true";
					} 
                    output.operation = payload.operation;
                    output.items = [payload];
                    return output;
                } else {
                    payload = this.getDisplayLabel(payload, context);
                    payload.operation = 'REPLACE';
                    payload.subToolbarOptions = {
                        viewportInfo: {
                            "route": "planner-menu",
                            "fields": {
                                projectSysId: context.fields.sysId || -1,
                                projectClass: context.fields.table || -1,
                                timeStamp: context.fields.timeStamp || Date.now()
                            },
                            "params": {
                                pageName: context.params.pageName || 'planning'
                            }
                        },
                        //optional fields, these impact the resize panel for subToolbar and everything on the right side
                        hideSubToolbar: false, //default will be true
                        defaultDividerPosition: 15,
                        dividerStyles: {},
                        "isExpanded": true,
                        disabled: true,
                        "rightPanelMinWidth": {
                            "minRatio": 80,
                            "minPixels": 100
                        },
                        "leftPanelMinWidth": {
                            "minRatio": 20,
                            "minPixels": 10
                        },
                        "displayDividerButton": true,
                        "position": "center"
                    };
					if(context.params.hideMenu === 'true' || context.params.hideMenu === true) {
						payload.subToolbarOptions.hideSubToolbar = true;
						payload.subToolbarOptions.viewportInfo.fields.projectSysId = -1;
						payload.subToolbarOptions.viewportInfo.fields.projectClass = -1;
						payload.subToolbarOptions.viewportInfo.params.hideMenu = "true";
					} 
                    output.items = [payload];
                    return output;
                }
			case 'doc-template-record': (SOME MORE CODE)
                        case 'simplelist': (SOME MORE CODE)
			case 'doc-templates': (SOME MORE CODE)
			case '403': (SOME MORE CODE)
			case '404': (SOME MORE CODE)
        }
    },

As you may see, behaviour of breadcrums is defined for each page in project workspace and, in fact, if you look at record case, there is a parameter called hideSubToolbar, which is forced to be "false" in general.

 

Here you can define the logic of your interest to show or hide subToolbar in record page. It is important also to take into account that if you want this logic to apply to a custom chromeTab (as I think you have done) you must also modify this function in the same Script Include:

getHandledRoutes: function() {
        /** Fill  all this toolbar items routes which this extension point handles */
        return ["home","doc-templates"];
    },

I hope this helps everybody in this issue, because I literally found the solution looking for other problems, it is not exactly easy to find this.

Teo2kids
Tera Expert

@nowitsvashu 

Hi Did you find a fix for the issue?