Question

How Hide or Remove Actions from a Section

Hello to everyone!

I'm trying to Hide or Remove Actions from a Section.

i.e: Data Import or Export to Excel

any ideas?

Thanks in advance for your support

Regards,

Fernando

Like 0

Like

13 comments

Hello Fernando,

The default actions collection is populated in the getSectionActions method of the BaseSectionV2 schema (https://prnt.sc/ko83fb). 

In order to remove or hide any of the default actions from the section, you need to create a replacing schema and override the getSectionActions method.

In order to hide the specific action, you will need to change a Visible property:

getSectionActions: function() {

                var actionMenuItems = this.callParent(arguments);

                actionMenuItems.each(function(item) {

                    if(item.values.Caption.bindTo === "Resources.Strings.ExportListToExcelFileButtonCaption"){

                        item.values.Visible = false;

                    }

                });

                return actionMenuItems;

            }

In order to remove the specific action from the collection:

getSectionActions: function() {

                var actionMenuItems = this.callParent(arguments);

                var itemToRemove;

                actionMenuItems.each(function(item) {

                    if(item.values.Caption.bindTo === "Resources.Strings.ExportListToExcelFileButtonCaption"){

                        itemToRemove = item;

                    }

                });

                actionMenuItems.remove(itemToRemove);

                return actionMenuItems;

            }

 

Thanks Tetiana!

 

Where we configure the filters.

Example: I don't want to see the Owner filter in Lead Sections

also ...what happens if I need to hide or remove any of these objects?

Hello Fernando,



You can configure your own filters as well as override existing ones in the initFixedFiltersConfig method. Please, see the documentation - https://academy.bpmonline.com/documents/technic-sdk/7-12/adding-quick-f…



Could you, please specify your second question, please?

Hi Tetiana, i'm trying to hide or remove this Object (Filter) from Lead Section

 

Fernando,



You need to override the initFixedFiltersConfig method in your LeadSectionV2 replacing client schema.

    initFixedFiltersConfig: function() {

                        var fixedFilterConfig = {

                            entitySchema: this.entitySchema,

                            filters: []

                        };

                        this.set("FixedFilterConfig", fixedFilterConfig);

                    }

In such case, there will be no filters in the Lead Section. You can also configure your own filters in the 'filters' array.

Please, see the documentation - https://academy.bpmonline.com/documents/technic-sdk/7-12/adding-quick-f…

Thanks Tetiana!

I want to remove the "Data import" in the Action menu but couldn't find any related string under "LocalizableStrings" in BaseSectionV2. Please help.

 

JP Ngo,

Please take a look at getDataImportMenuItem method of BaseDataView schema. It creates data import menu item for section actions.

			getDataImportMenuItem: function() {
				if (this.getIsImportEnabled()) {
					const config = this.getFileImportMenuItemCfg();
					return this.getButtonMenuItem(config);
				}
			},

This method is executed from getSectionActions method. 

Regards,

Anastasia

Hello Tetiana Markova,

 

I tried to remove the cancel case action from the portal section using the getActions method as you demonstrated above, but when I add some conditions to the method it doesn't work correctly.

 

Below is my code:

 

getActions: function() {

                var NumberOfGuests = this.get("UsrHousingGuest");

                var actionMenuItems = this.callParent(arguments);

                var itemToRemove;

                actionMenuItems.each(function(item) {

                    if(item.values.Caption.bindTo === "Resources.Strings.CancelCaseActionCaption"){

                        if(NumberOfGuests <= 50 && UsrNumberOfDaysOrMonths <= 2){

                                itemToRemove = item;

                        }

                    }

                });

                actionMenuItems.remove(itemToRemove);

                return actionMenuItems;

            },

 

Do you have any recommendations to make please?

 

Many thanks.

 

 

Mouna RACHIDI,

 

Hello,

 

getActions method override should be added to the PortalCasePage schema and also you need to check if NumberOfGuests and UsrNumberOfDaysOrMonths (by the way this variable is never declared in your part of code, so it's undefined and the if clause will be never executed) have correspondent values. After I checked both parts this method worked in my local app.

 

Best regards,

Oscar

Show all comments