AnsweredAssumed Answered

Add "create" button in search popup

Question asked by Véronica Véronica on Dec 22, 2014
Latest reply on Mar 13, 2015 by Soukaina IDRISSI
Hello!!

I work with SugarCE 6.5.16 and I am trying to add the "Create" button in search popup of my module sim_Homologaciones similar to search popup the Account module.


I have done the next. My custom module name is sim_Homologaciones.

1. I have created the file popupdefs.php with the next code:
    $module_name = 'sim_Homologaciones';
    $object_name = 'sim_Homologaciones';
    $_module_name = 'sim_Homologaciones';
    global $mod_strings;
    $popupMeta = array(
                     'moduleMain' => $module_name,
                     'varName' => $object_name,
                     'orderBy' => $_module_name.'.name',
                     'whereClauses' => 
                              array('name' => $_module_name . '.name', 
                       ),
  
                      'searchInputs'=> array($_module_name. '_number', 'name', 'priority','status'),
 
                       'create' =>
                                array('formBase' => 'sim_HomologacionesFormBase.php',
                                         'formBaseClass' => 'sim_HomologacionesFormBase',
                                         'getFormBodyParams' => array(",",'sim_HomologacionesSave’),
                                         'createButton' => $mod_strings['LNK_NEW_sim_Homologaciones'],  
   ),
      
);

And I've added to /var/www/html/custom/modules/sim_Homologaciones/metadata

2.  After I have created the file sim_HomologacionesFormBase.php and I've added to 
/var/www/html/custom/modules/sim_Homologaciones and /var/www/html/modules/sim_Homologaciones

<?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();

}
}

?>

3. Finaly quick repair and rebuild.

When open the search popup is blank. :(

I don't know what failure. Anybody help me, please?

Thanks in advance.

Outcomes