Validating a Record Before a Printable Can be Run in Creatio

When using a printable in Creatio on a record page, you might want to control when the printable can be run based on conditions such as whether the data is complete on the record. This is an easy task by overriding a function that exists on the page. Note, this method can be used to validate the record or for other purposes such as to control who can run a particular printable.

The print menu itself, along with the capability to run a printable, is added to a page via the PrintReportUtilities mixin. When an item is clicked on the Print menu, it executes a function on the page called generateCardPrintForm (added from the mixin). To override what happens when a printable is clicked from the print menu, all we need to do is override that function and then pass along to the function parent when/if we want to allow the actual print to occur.

For the scenario of this article, we will be controlling whether a printable named “Account contract” can be printed unless all required data that we need in the printable is completed on the record. The end result will look like this:

This is what our code will look like:

generateCardPrintForm: function(tag) {
    // first get the printable being accessed
    var printFormsCollection = this.get(this.moduleCardPrintFormsCollectionName),
        printForm = printFormsCollection.get(tag);

    // check if this is the printable we want to validate before use
    if (printForm.values.Caption === "Account contract") {
        var dueDate = this.get("UsrDue");

        // check if the record is complete			
        if (Ext.isEmpty(dueDate)) {
            var msg = "The following missing information must be added before the contract can be generated:\r\n\r\n";
            msg += " - Due date\r\n";


        // record is complete, allow print		
    else {
        // this was not the printable we need to validate, allow print

All we need to do here is get a reference to the actual form being printed. The function receives a tag, which is the Id of the printable itself. We’ll use that to get the printable details from the collection that stores all the printables displayed in the print menu. Then we can check to see if it is the printable we want to validate before using. When/if we want to allow the print to continue, we simply call the parent function using this.callParent(arguments) which allows things to continue normally.

Want content like this delivered to your inbox? Sign up for our newsletter!

Ryan Farley

Ryan Farley is the Director of Development for Customer FX and creator of He's been blogging regularly about SalesLogix, now Infor CRM, since 2001 and believes in sharing with the community. His new passion for CRM is Creatio, formerly bpm'online. He loves C#, Javascript, web development, open source, and Linux. He also loves his hobby as an amateur filmmaker.

Submit a Comment

Your email address will not be published. Required fields are marked *