How can i add filters or execute methods through the addRecord button?

Hi,

is it possible to apply filters to the addRecord button? If so, how can i apply them and execute methods when pressing it.

This print shows the section page with the addRecord button "Novo".

Like 0

Like

1 comments

Dear Pedro,

In order to apply filters to the “addRecord” button please do the following:

1. Create a replacing client schema module. Please find more information in the article by the link below:

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

2. Set “Parent object” property to “Base data view” value https://prnt.sc/psavyp

3. Use the following code as an example:

define("BaseDataView", [], function(){

return{

                messages: {},

                mixins: {},

                methods: {                                         

                // new custom method

                TestMethod: function(){

                                return true;

                },

                // overriding addRecord method

                addRecord: function(typeColumnValue){

                var schema = this.getEditPageSchemaName(typeColumnValue);

                if(schema === "AccountPageV2"){

                                // use here your methods or filters

                                this.TestMethod();

                                }

                this.callParent(arguments);

                }

                },

                diff: /**SCHEMA_DIFF*/ [] /**SCHEMA_DIFF*/

                                };

});

 

Please find more information about filters in the article by the links below:

https://academy.creatio.com/documents/technic-sdk/7-14/entityschemaquery-class-filters-handling?_ga=2.100001118.1940880110.1572861922-1199877090.1572861922

https://academy.creatio.com/documents/technic-sdk/7-13/entityschemaquery-filters-handling?_ga=2.5228019.1940880110.1572861922-1199877090.1572861922

4. In case, if it is need to apply a filter only for particular sections, please add a name of these sections to the following part of code:

if(schema === "Section name"){

// use here your methods or filters

                this.TestMethod();

}

 

Please note that it is possible to find the name of the particular section in the query string. For example, for Account section the name is “AccountSectionV2”. Please see the screenshot below:

https://prnt.sc/psb2jp

 

Best regards,

Norton

Show all comments