Question

How to Hide button in contact section page while saving record

 Can anyone help me how  to hide this button while saving the contact information with same credentials.

Like

12 comments

Dear Praveen,

In order to add any logic to the page, please create a replacing module schema for LocalDuplicateSearchPageV2 schema. The button of interest is called "IsNotDuplicateAction" button. The save method, which is triggered on Save button click is saveBtnClick. You can override the basic logic, so to hide/show button up to your needs.

Regards,

Anastasia

Anastasia Botezat,

i was created the replacing schema for that but it was still showing that button on contact page . can you please help me on this code  Here the code.

define("LocalDuplicateSearchPageV2", ["LocalDuplicateSearchPageV2Resources", "DefaultProfileHelper",
        "GridUtilitiesV2", "css!LocalDuplicateSearchPageV2CSS", "DuplicatesSearchUtilitiesV2"],
        function(resources, DefaultProfileHelper) {
    return{
        diff: /**SCHEMA_DIFF*/[
                {
                "operation": "insert",
                "name": "IsNotDuplicateAction",
                "parentName": "DataGrid",
                "propertyName": "activeRowActions",
                "values": {
                    "className": "Terrasoft.Button",
                    "style": Terrasoft.controls.ButtonEnums.style.BLUE,
                    "caption": resources.localizableStrings.IsNotDuplicateCaption,
                    "tag": "IsNotDuplicate",
                    "visible": false,
                    }
                },
            {
                "operation": "insert",
                "name": "IsDuplicateAction",
                "parentName": "DataGrid",
                "propertyName": "activeRowActions",
                "values": {
                    "className": "Terrasoft.Button",
                    "style": Terrasoft.controls.ButtonEnums.style.BLUE,
                    "caption": resources.localizableStrings.IsDuplicateCaption,
                    "tag": "IsDuplicate",
                    "visible": false,
                        
                    }
                }
            ]/**SCHEMA_DIFF*/
    };
});
 

praveen n,

Since you are modifying the existing button, you do not need to insert it, but merge. Please see the instructions on working with diff array elements in the article:

https://academy.bpmonline.com/documents/technic-sdk/7-13/diff-array

Regards,

Anastasia

Miroslav Kytka,

The visibilty property works as you have indicated. In the diff of the element you indicate

"visible": { bindTo: "methodName"}

and in the methods block of the schema you add the method. 

In your case please try firstly to indicate "visibility": true in the diff block. Clear cache and make sure, that the button appears on the page in the first place.

Afterwards, test whether the method us triggered. Put a breackpoint inside the method to see if the method is actually executing.

Also, please see the article below for more examples of functionality implementation.

https://academy.bpmonline.com/documents/technic-sdk/7-12/how-add-button…

Regards,

Anastasia

Anastasia Botezat,

Thank you for your response. I have tried to debug my method, I have put breakpoint into function and it haven't hit the breakpoint. Method probably isn't executing. I also have cleared the cache, but it haven't helped. I don't know where is the problem.
Here is code of my schema.

define("UsrEntityReloadTest1Section", ["UsrEntityReloadTest1SectionResources"], 
function(resources) {
    return {
        entitySchemaName: "UsrEntityReloadTest",
        attributes: {},
        details: /**SCHEMA_DETAILS*/{}/**SCHEMA_DETAILS*/,
        methods: {
            setVisibilityOfLockButton: function(){
                return true;
            },
            lock: function(){
                this.showInformationDialog("Record is locked.");
            },
            onActiveRowAction: function(buttonTag, primaryColumnValue) {
                switch (buttonTag) {
                    case "lock":
                        this.lock();
                        break;
                    default:
                        break;
                }
            }
        },
        diff: /**SCHEMA_DIFF*/[
                {
                    "operation": "insert",
                    "name": "MyCustomLockAction",
                    "parentName": "DataGrid",
                    "propertyName": "activeRowActions",
                    "values": {
                        "className": "Terrasoft.Button",
                        "style": Terrasoft.controls.ButtonEnums.style.BLUE,
                        "caption": resources.localizableStrings.UsrLockCaption,
                        "tag": "lock",
                        "visible": { bindTo: "setVisibilityOfLockButton" }
                    }
                
                }
            ]/**SCHEMA_DIFF*/
    };
});

Regards,

Miroslav

Miroslav Kytka,

Does the button display when you hardcode "true" into the visibility property in the diff? Maybe the issue is with the button insert or its positioning.

Anastasia Botezat,

Yes, when I set it to "true", button is visible.

Miroslav Kytka,

I apologize, I haven't payed attention, that this is an active row of the grid. 

The active row in the grid has its own viewmodel. Each section in the system is inheriting active row configuration from the BaseGridRowViewModel. 

Therefore, since it is a custom section, in order for the bindings to work you need to create a new module, inherit from the BaseGridRowViewModel. In the schema, you need to add the logic for visibility property. 

Please take any other grid row VewModel as an example.

Hope you will find it helpful.

Regards,

Anastasia

Anastasia Botezat,

thank you for your response. My custom viewModel had to inherit from 

BaseSectionGridRowViewModel, because I want keep standard buttons (open, copy, delete,...). Now it works.
Thank you so much.

Regards,
Miroslav

Anastasia Botezat,

Hi Anastasia,

I am also facing same scenario, any example how the custom viewmodel will look like, how the logic for visibility property will look like?

Fulgen Ninofranco,

Implementation of such viewmodel can be found in oob schemas. For example, "ActivitySectionGridRowViewModel" in package "UiV2". Then, in "ActivitySectionV2" in package "NUI", viewmodel is imported http://prntscr.com/nc64s3 and it will be used instead of BaseSectionGridViewModel.

The example how to bind visibility property can be found in Anastasia`s answers above. 

Best regards,
Alex 

Alex_Tim,

Hi Alex, thanks for your reply. Do you have any example how I can add the visibility property in my grid row view model and bind it to the data active row button on my section?

Log in or register to comment