Hide a page in a new button (Hide an option from the new button drop down)

Hi All,

 

Is there any possibility to hide a page (as highlighted below) from the new button in an old UI section?

 

 

Kindly help us resolve this issue.

 

Thank you

Geeviniy.

Like 0

Like

6 comments
Best reply

Hi Oleg,

 

This works like a charm. Thank you very much for the solution.

 

I have also added a code snippet, just in case if anybody needs to remove multiple pages from the dropdown of the new button,

{
				"operation": "merge",
				"name": "SeparateModeAddRecordButton",
				"parentName": "SeparateModeActionButtonsLeftContainer",
				"propertyName": "items",
				"values": {
					"controlConfig": {
						"menu": {
							"items": {
								"bindTo": "EditPages",
								"bindConfig": {
									"converter": function(editPages) {
										if (editPages.getCount() > 1) {
											var valuesToRemove = [];
											for (var i = 0; i < editPages.getCount(); i++) {
												var caption = editPages.getItems()[i].values.Caption;
												if (caption === "Returned Mail" || caption === "Default" || caption === "Posting Restriction" || caption === "KYC Review") {
													valuesToRemove.push(i);
												}
											}
											for (var j = valuesToRemove.length - 1; j >= 0; j--) {
												editPages.removeByIndex(valuesToRemove[j]);
											}
											return editPages;
										} else {
											return null;
										}
									}
								}
							}
						}
					}
				}
			},

 

We only need to modify the captions according to our requirements.

 

Thank you

Best Regards,

Geeviniy

Dear Jana,



The same questions were asked on the community previously, and you can find those questions hereherehere, and here. Please refer to those articles so to be able to hide a button.



And 

There were a couple of  similar requests on our community. You can find the solutions here: 

 

https://community.bpmonline.com/articles/how-can-i-hide-button-portal-users

https://community.bpmonline.com/questions/how-hide-button-existed-record

https://community.bpmonline.com/questions/removing-new-case-button-portal-case-section

https://community.bpmonline.com/questions/hide-section-button-edit-page 





Best regards,

Orkhan

Hi Orkhan,

 

I referred to all the articles that you have shared above. In fact, the question I raised is similar to the below article.

https://community.creatio.com/questions/how-hide-page-new-button

 

But seems like, the shared community articles are irrelevant to what we raised. Those articles describe hiding the new button itself. But the requirement for us is to keep the new button and just hide one or more pages from the new button drop-down when there are more pages in that particular section. Kindly double-check and help us resolve this issue.

 

Thank you

Geeviniy.

Geeviniy Vazavan,



Thank you for your feedback, give us some time so we can help you with this problem.

 

Best regards,

Orkhan

 

Geeviniy Vazavan,

 

Hello,

 

Here is a fast and working example: in the section schema you need to create a replacement of the SeparateModeAddRecordButton element in the diff:

define("OrderSectionV2", [], function() {
	return {
		entitySchemaName: "Order",
		details: /**SCHEMA_DETAILS*/{}/**SCHEMA_DETAILS*/,
		diff: /**SCHEMA_DIFF*/[
			{
				"operation": "merge",
				"name": "SeparateModeAddRecordButton",
				"parentName": "SeparateModeActionButtonsLeftContainer",
				"propertyName": "items",
				"values": {
					"controlConfig": {
						"menu": {
							"items": {
								"bindTo": "EditPages",
								"bindConfig": {
									"converter": function(editPages) {
										if (editPages.getCount() > 1) {
											var valueToRemove;
											for (var i = 0; i < editPages.getCount(); i++) {
												if (editPages.getItems()[i].values.Caption == "Website") {
													valueToRemove  = i;
												}
											}
											if (valueToRemove || valueToRemove == 0) {
												editPages.removeByIndex(valueToRemove);
											}
											return editPages;
										} else {
											return null;
										}
									}
								}
							}
						}
					}
				}
			},
		]/**SCHEMA_DIFF*/,
		methods: {}
	};
});

You only need tp modify the "Website" in the code with the caption of the edit page you need to remove from the "New" option. After that refresh the page and the menu item will be removed. Debug the execution of the example above and add your own logic if needed.

Hi Oleg,

 

This works like a charm. Thank you very much for the solution.

 

I have also added a code snippet, just in case if anybody needs to remove multiple pages from the dropdown of the new button,

{
				"operation": "merge",
				"name": "SeparateModeAddRecordButton",
				"parentName": "SeparateModeActionButtonsLeftContainer",
				"propertyName": "items",
				"values": {
					"controlConfig": {
						"menu": {
							"items": {
								"bindTo": "EditPages",
								"bindConfig": {
									"converter": function(editPages) {
										if (editPages.getCount() > 1) {
											var valuesToRemove = [];
											for (var i = 0; i < editPages.getCount(); i++) {
												var caption = editPages.getItems()[i].values.Caption;
												if (caption === "Returned Mail" || caption === "Default" || caption === "Posting Restriction" || caption === "KYC Review") {
													valuesToRemove.push(i);
												}
											}
											for (var j = valuesToRemove.length - 1; j >= 0; j--) {
												editPages.removeByIndex(valuesToRemove[j]);
											}
											return editPages;
										} else {
											return null;
										}
									}
								}
							}
						}
					}
				}
			},

 

We only need to modify the captions according to our requirements.

 

Thank you

Best Regards,

Geeviniy

Geeviniy Vazavan,

Hi Oleg,

 

Quick clarification. Can we disable the options in the new button drop-down? (Make it not clickable, but it should be visible)

Show all comments