Add custom button in popup view in suitecrm

Hello friends i want to add a custom button inside popup view. Is it possible ? can you show me the correct way to do it ?

here’s an screenshot of the popup window:

Tried following this site’s sample: Link here

I have put this file in custom/modules/FP_PAYMENTS/metadata/popupdefs.php

<?php
$popupMeta = array(
    'moduleMain' => 'FP_PAYMENTS',
    'varName' => 'FP_PAYMENTS',
    'orderBy' => 'fp_payments.name',
    'whereClauses' => array(
        'name' => 'fp_payments.name',
        'payment_type_c' => 'fp_payments.payment_type_c',
        'payment_stage' => 'fp_payments.payment_stage',
        'amount' => 'fp_payments.amount',
        'or_no' => 'fp_payments.or_no',
        'payment_date' => 'fp_payments.payment_date',
        'fp_subscriptions_fp_payments_1_name' => 'fp_payments.fp_subscriptions_fp_payments_1_name',
        'accounts_fp_payments_1_name' => 'fp_payments.accounts_fp_payments_1_name',
    ),
    'searchInputs' => array(
        1 => 'payment_date',
        2 => 'payment_stage',
        3 => 'or_no',
    ),
    'create' => array (
        'formBase' => 'sim_HomologacionesFormBase.php',
        'formBaseClass' => 'sim_HomologacionesFormBase',
        'getFormBodyParams' =>
            array (
                0 => '',
                1 => '',
                2 => 'sim_HomologacionesSave',
            ),
        'createButton' => 'LNK_NEW_SIM_HOMOLOGACIONES',
    ),
    'searchdefs' => array(
        'payment_date' => array(
            'type' => 'varchar',
            'studio' => 'visible',
            'label' => 'LBL_PAYMENT_DATE',
            'width' => '10%',
            'name' => 'payment_date',
        ),
        'payment_stage' => array(
            'type' => 'enum',
            'studio' => 'visible',
            'label' => 'LBL_PAYMENT_STAGE',
            'width' => '10%',
            'name' => 'payment_stage',
        ),
        'or_no' => array(
            'type' => 'varchar',
            'studio' => 'visible',
            'label' => 'LBL_OR_NO',
            'width' => '10%',
            'name' => 'or_no',
        ),
        'fp_subscriptions_fp_payments_1_name' =>
            array(
                'type' => 'relate',
                'link' => true,
                'label' => 'LBL_FP_SUBSCRIPTIONS_FP_PAYMENTS_1_FROM_FP_SUBSCRIPTIONS_TITLE',
                'width' => '10%',
                'id' => 'FP_SUBSCRIPTIONS_FP_PAYMENTS_1FP_SUBSCRIPTIONS_IDA',
                'name' => 'fp_subscriptions_fp_payments_1_name',
            ),
    ),
    'listviewdefs' => array(
        'NAME' =>
            array(
                'width' => '32%',
                'label' => 'LBL_NAME',
                'default' => true,
                'link' => true,
                'name' => 'name',
            ),
        'PAYMENT_STAGE' =>
            array(
                'type' => 'enum',
                'studio' => 'visible',
                'label' => 'LBL_PAYMENT_STAGE',
                'width' => '10%',
                'default' => true,
                'name' => 'payment_stage',
            ),
        'AMOUNT' =>
            array(
                'type' => 'currency',
                'label' => 'LBL_AMOUNT',
                'currency_format' => true,
                'width' => '10%',
                'default' => true,
                'name' => 'amount',
            ),
        'OR_NO' =>
            array(
                'type' => 'varchar',
                'label' => 'LBL_OR_NO',
                'width' => '10%',
                'default' => true,
                'name' => 'or_no',
            ),
        'PAYMENT_DATE' =>
            array(
                'type' => 'varchar',
                'label' => 'LBL_PAYMENT_DATE',
                'width' => '10%',
                'default' => true,
                'name' => 'payment_date',
            ),
    ),
);

After that i have created the file sim_HomologacionesFormBase.php and I’ve added to custom/modules/sim_HomologacionesFormBase.php and added also in modules/sim_HomologacionesFormBase.php:

<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
require_once('include/SugarObjects/forms/FormBase.php');

class sim_HomologacionesFormBase extends FormBase {

    var $moduleName = 'sim_Homologaciones';
    var $objectName = 'sim_Homologaciones';

    function handleSave($prefix, $redirect=true, $useRequired=false){
        require_once('include/formbase.php');
        $focus = new sim_Homologaciones();
        $focus = populateFromPost($prefix, $focus);
        $focus->save();

    }
}

Ive already fix error in the code but i still get the same result. “blank” what did i do wrong here ?

Hello any experts who can help me with this ?

1 Like

@alucard were you able to do this? I want to modify my popup filed also. I want to change the clear button function and add readonly field for my pre-filtered data,