Creatio development guide
PDF
This documentation is valid for Creatio version 7.16.0. We recommend using the newest version of Creatio documentation.

Methods. The "methods" property

Glossary Item Box

Introduction

The methods property of the view model schema contains a collection of methods that form the business logic of the schema and affect the view model. Create new methods and override (replace) base methods of parent schemas in this property. By default, the scope of methods is the view model scope.

Examples of method declaration

An example of a replaced method

Add the [Email] column completion requirement logic to the setValidationConfig method logic of the Terrasoft.configuration.BaseSchemaViewModel class.

methods: {
    // Method name.
    setValidationConfig: function() {
        // Calling the logic of the setValidationConfig parent schema method.
        this.callParent(arguments);
        // Setting up the validation for the [Email] column.
        this.addColumnValidator("Email", EmailHelper.getEmailValidator);
    }
}

An example of a new method

methods: {
    // Method name.
    getBlankSlateHeaderCaption: function() {
        // Accessing the MasterColumnInfo column values.
        var masterColumnInfo = this.get("MasterColumnInfo");
        // Returning method work results.
        return masterColumnInfo ? masterColumnInfo.caption : "";
    },
    // Method name.
    getBlankSlateIcon: function() {
        // Returning method work results.
        return this.Terrasoft.ImageUrlBuilder.getUrl(this.get("Resources.Images.BlankSlateIcon"));
    }
}
© Creatio 2002-2020.

Did you find this information useful?

How can we improve it?