Yep, would be useful to know how to add a Create Record button in a custom module... similar to what happens with the SugarCRM Accounts module on Search popup... Thank you! (from danelige)
Hiii danelige !! I get the solution and its work perfect :-) custom/modules/custom module/cityFormBase.php(need to create) same file also add in module/custom module/cityFormBase.php Add code : save(); } } ?> custom/modules/Custom_module /meta data/popupdef.php Add code this code in popupdef.php 'create' => array('formBase' => 'key_CityFormBase.php', 'formBaseClass' => 'key_CityFormBase', 'getFormBodyParams' => array('','','key_Citysave'), 'createButton' => $mod_strings['LNK_NEW_RECORD'] ), Then repair and check ... All the best !! (from Ishani Lad)
it's good, it works solution: ********** After adding the above code to the file: <root>/custom/modules/<MyModule>/metadata/popupdef.php -------------------------------------------------- Step 2: I create a file: <root>/custom/modules/<MyModule>/<MyModule>FormBase.php, the content:
<?php if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); require_once('include/SugarObjects/forms/FormBase.php');
class MyModuleFormBase extends FormBase {
var $moduleName = 'MyModule'; var $objectName = 'MyModule';
function handleSave($prefix, $redirect=true, $useRequired=false){ require_once('include/formbase.php'); $focus = new MyModule(); $focus = populateFromPost($prefix, $focus); $focus->save();
} }
?>
I keep a copy of this file that I put to: <root>/modules/<MyModule>/<MyModule>FormBase.php
but I found a bug, when I pass in studio-> MyModule-> Page Setup-> View popup, the following error appears: Notice: Undefined variable: mod_strings in <root> \ custom \ modules \ <MyModule> \ metadata \ popupdefs.php on line 26 namely: at this level 'CreateButton' => $ mod_strings ['LNK_NEW_RECORD']