diff: /**SCHEMA_DIFF*/[
         {
            
       "operation": "merge",
       "name": "DataGrid",
       "values": {
               "activeRowAction": {bindTo: "onActiveRowAction"},
               "activeRowActions": [
                       {
                               "className": "Terrasoft.Button",
                               "style":this.Terrasoft.controls.ButtonEnums.style.BLUE,
                               "markerValue": "myButtonAction",
                               "tag": "myAction",
                               "caption": "View image",
                               "enabled": false,
                               "visible":{bindTo: "IsButtonVisible"},
                         
                                 
                       }
               ],
               // "visible": {"bindTo": "isButtonVisible"},
               
       }
}
       ]/**SCHEMA_DIFF*/,
        methods: {
            isButtonVisible: function()
            {
           console.log("hello");
           const activerow= this.get("ActiveRow");
           if(activerow)
            {
 
              var msg= this.getActiveRow().get("UsrMessage") ;
               if(msg==="hello"){return false;}
               
            }
           return true;
             
         }
       }
    };

I tried adding button, and when giving visible:true, it is working fine, now i want to hide that button from some records of detail based on some condition so i bind it with the function, but it is not working, the function is not getting called/executed, when i am doing it at grid level then it is working fine, but not working on button, is there something am i missing or doing wrong, i even tried it using attribute and setting it's value in the function

Like 0

Like

2 comments

I've never been successful with binding values in ActiveRowActions to attributes to change them after render. They don't seem to have the same bindings as other view model elements do. The only way I've been able to get this to work is to modify the dom elements on row select to manipulate, which is a bit hacky. Alternatively, just add logic to the button click to validate if the action can be performed or not, which isn't ideal either.

Ryan

Ryan Farley,

Can you please elaborate on modifying dom elements, how can i do that, because that's the only option i can see too

 

Show all comments

Hi all,



I've added a button to the left container of the orders page labelled 'Update quote costs'. The button is visible on the condition that the boolean 'Recalculation required' (a field on the order) is true. I've added the diff and the method to the section schema and the section page.

(edit - added gif of button)

 

When I open the page from the section for a record where 'Recalculation required' is true, the button does not appear. If I refresh the page, the button then does.

 

I believe this is because the header loads before the data so when it first loads, it can't read the 'Recalculation required' field.



Is there a solution to this? If not, I can move the button to the header container as the conditions do work this way. It just doesn't look as good.



Nb. using Freedom shell on classic pages

Like 0

Like

1 comments

Hello,

The problem is not in the container, when you open a page from a section, the system still thinks that you see a section page. Therefore, the condition for your button isn't applied.

In order to fix it, you need to create your button in a combined mode, for example.

Take a look at the button and its condition is defined in a SectionV2 page as well as PageV2.

Show all comments

Hi community,

How to hide the "Copy" and "Delete" button in the list?

Thank you

Like 0

Like

2 comments

The "Customer FX" is resourceful... 

Thanks, Rob.

Show all comments
Question

Hi! I wanted to hide a process button and I found a code that could work but I am not sure where to put the name of my button.

 

This is the code: 

 

define("ContactSectionV2", [],

    function() {

    return {

        entitySchemaName: "Contact",

        attributes: {

            "ButtonVisible": {

                "dataValueType": Terrasoft.DataValueType.BOOLEAN,

                "type": Terrasoft.ViewModelColumnType.VIRTUAL_COLUMN,

                "value": true

            }

        },

        messages: {},

        methods: {

             onCardRendered: function() {

                 this.callParent();

                 this.set("ButtonVisible", false);

             }

        },

        diff: /**SCHEMA_DIFF*/[

            {

                "operation": "insert",

                "parentName": "ActionButtonsContainer",

                "propertyName": "items",

                "name": "MainContactSectionButton",

                "values": {

                    itemType: Terrasoft.ViewItemType.BUTTON,

                    caption: { bindTo: "Resources.Strings.TestButton" },

                    "visible": {bindTo: "ButtonVisible"},

                    "layout": {

                        "column": 1,

                        "row": 6,

                        "colSpan": 1

                    }

                }

            }

        ]/**SCHEMA_DIFF*/

    };

});

 

Thank you!

Like 0

Like

9 comments

Hi,

I don't really understand what you mean by putting the name of the button, but, if you want to hide you need to find it in the diff section of the page where your button is located and add to it a parameter "visible", as shown on your code.

This parameter is bound to a method "ButtonVisible" and in it, you can return true or false based on the needed condition.

Dmytro Vovchenko,

Thank you! You're right. But I have one problem, I can't find my button in diff. It is a run process button. I searched for this type of button in other sections also, but I can't find it there also. I don't know if process buttons are made differently.

In that case, can you please show the button you are talking about?

 

This one: (Run process)

Ghiu Diana Stefania,

With this button you can simply add to diff of the needed page this statement:

			{
				"operation": "merge",
				"name": "ProcessButton",
				"values": {
					"visible": false
				}
			},

Or instead:

"visible": {bindTo: "ButtonVisible"},

Small remark, this button is not your average one, so probably the best way is to bind the visible parameter to a method. In this method return true or false based on your condition.

It still doesn't work

Try opening your record page and refresh it with F5, I bet that the button will disappear. As I said, this button is pretty special. First of all, its realization is buried somewhere in the base page logic and if it is displayed on any section then it will be shown on both section and record pages. When you are opening the record page from the section than the system will remember some aspects from the section page, which includes the values of this button. In that case, try adding the same diff to the section page as well. Also, this button will disappear by itself if you don't have any business-processes attached to the section.

Dmytro Vovchenko,

I made it work to hide it but I need to put a condition also.  If I put it in methods it does nothing. I can only make the button visible or invisible. Do you have any idea?

 

As I said, you need to bind the parameter "visible" to a method and in that method write a condition that will return true or false.

"visible": { bindTo: "isVisible" }

 

isVisible: function() {

             if ( ---- )  

                     return true;

             return false;

}

Note, this must be present on both pages.

If this won't work, then I believe with the current logic of this button it would be impossible to hide it with your conditions (or this task will require a lot of modifications of base logic, and I'm not sure it is worth it)

Show all comments

Hi,

        How can I remove the button "New" in section?

Thanks

Like 0

Like

1 comments

Hello. i'd like to hide the 'Run Process' -button in the Side Panel for certain Roles.

As well as change the contents of the drop-down of the 'Home' -button next to it.

Like 0

Like

3 comments

Dear Julius, 

In order to hide the button menu, you need to override the basic functionality, which involves development within the system.

Firstly, you need to override basic schema LeftPanelTopMenuModule. Please find the loadMenu method. There you can see that visibility of the button in based on user type. You can add your custom method to check current user rights and set the visibility based on the response result:

Here is an example of how to check current user role. In the example we are hiding the Menu button form non-administrators role. You can adjust the code up to your needs. (the example involves creating of custom CSS style and adding it to the schema dependencies):

 

As for the list of menu items, please take a look at  loadItemsMainMenu method, which is responsible for its logic.

Hope you will find it helpful.

Regards,

Anastasia

Anastasia Botezat,

 

How do you override the LeftPanelTopMenuModule module? I cannot create a replacing client module, so not sure how I would go about this. Is it no longer possible to do this?

Hi Harvey Adcock,

 

In order to replace "LeftPanelTopMenuModule" client module schema, please follow the steps described below:

 

1. Please go to Configuration > Add > Module

2. In the appeared empty module, please add the code below:

define("UsrLeftPanelTopMenuModule", ["LeftPanelTopMenuModule", "LeftPanelTopMenuModuleResources"],
 function() {
 Ext.define("Terrasoft.UsrLeftPanelTopMenuModule", {
 override: "Terrasoft.LeftPanelTopMenuModuleViewModel",
 /*
 * @override
 */
			...
 });
 }
);

Also, please add Title "UsrLeftPanelTopMenuModule" and Name "UsrLeftPanelTopMenuModule", choose the package. Important: do not set the parent object. Save the module.

 

3. Then, you need to replace "BootstrapModulesV2". Here is the article on how to replace client module schema:

 

https://academy.creatio.com/documents/technic-sdk/7-16/creating-custom-client-module-schema

 

4. In a new replacing client schema, please insert the code below:

 

define("BootstrapModulesV2", ["UsrLeftPanelTopMenuModule"], function() {
	return {};
});

Set "BootstrapModulesV2" as Title and Name, set "BootstrapModulesV2" (NUI) as a parent object, set replace parent input checked. 

 

5. Save the changes and hard-reload the page. 

Show all comments

Hello,

I am looking to enable/disable a button based on whether a user is in a certain functional group. What is the best way to do this? One way possibly is to build an entity schema query to pull a user's role information, but I haven't been able to find details on the object that contains user->role associations.

Any feedback is appreciated. Thanks!

Allen

 

Like 0

Like

2 comments

Dear Allen,

You are looking for SysAdminUnitInRole and SysUserInRole objects. 

 

Thanks Lisa!

Show all comments

Hello!

I hope you can help me!

I want to hide the "Contact" button from the Quick Add Menu

How could I do this?

King Regards,

Ezequiel

Like 0

Like

1 comments

Hi,

There is the lookup called  Quick Add menu setup:

Image.png



You can apply the necessary changes there. Please note that you need to log out and back it for the changes to be applied. 

Show all comments