SugarCRM: Dynamically create dropdown values
<?php
//load needed libraries
require_once('modules/ModuleBuilder/MB/ModuleBuilder.php');
require_once('modules/ModuleBuilder/parsers/parser.dropdown.php');
$parser = new ParserDropDown();
$params = array();
$_REQUEST['view_package'] = 'studio'; //need this in parser.dropdown.php
$params['view_package'] = 'studio';
$params['dropdown_name'] = 'test_dropdown_list'; //replace with the dropdown name
$params['dropdown_lang'] = 'en_us';
//create your list...substitute with db query as needed
$drop_list[] = array('-blank-','');
$drop_list[] = array('First','This is the First Text');
$drop_list[] = array('Second','This is the Second Text');
$drop_list[] = array('Third','This is the Third Text');
$json = getJSONobj();
$params['list_value'] = $json->encode( $drop_list );
$parser->saveDropDown($params);
?>
Related articles
- How can I have one dropdown hide/show depending on the selection of another dropdown? (stackoverflow.com)
- single validation script for select dropdown (stackoverflow.com)
- populate a select dropdown on the basis of other other select dropdown (stackoverflow.com)
- SugarCRM: listview link for relate field (phpbugs.wordpress.com)
SugarCRM: listview link for relate field
Open the file custom/modules/KEY_Module1/metadata/listviewdef.php
Replace the particualr field array with the below line
'FIELD_C' =>
array (
'type' => 'relate',
'link' => 'key_module1_key_module2',
'module' => 'KEY_Module1',
'id' => 'FIELDNAME_C',
'default' => true,
'studio' => 'visible',
'label' => 'LBL_FIELD',
'width' => '10%',
'related_fields' => array('fieldname_c'),
),
Related articles
- SugarCRM 6.3 enhances importing in Community Edition (h-online.com)
- Thoughts on Sugar CRM (ebiztechs.wordpress.com)
SugarCRM: On import field type int with validation range not working
Edit the file modules/Import/ImportFieldSanitize.php
Replace the function int with the below code
/**
* Validate int fields
*
* @param $value string
* @param $vardef array
* @return string sanitized and validated value on success, bool false on failure
*/
public function int(
$value,
$vardef
)
{
$value = str_replace($this->num_grp_sep,"",$value);
if (!is_numeric($value) || strstr($value,".")) {
return false;
}
if (isset($vardef['validation']) && $vardef['validation']['type']=='range') {
$min = $vardef['validation']['min'];
$max = $vardef['validation']['max'];
if ($value$max) {
return false;
}
}
return $value;
}
SugarCRM: retrieve a record ID using name and other fields
Use the function retrieve_by_string_fields to retrieve a record using multiple search filters.
See Example below:
$call = new Call();
$call->retrieve_by_string_fields(array('name'=>'NAMETOSEARCH','deleted'=>0,'assigned_user_id'=>'USER_ID'));
echo $call->description;
Related articles
- CRMState Launches as the Premier SugarCRM Application Monitor Service (prweb.com)
- SugarCRM and SIOS Announce Partnership (prweb.com)
- SugarCRM Announces Sugar iPad Application Powered by Appcelerator Titanium (prweb.com)
- Java Connector to SugarCRM Webservices (ashwinrayaprolu.wordpress.com)
- Install SugarCRM on UBUNTU (cleanclouds.wordpress.com)
SugarCRM: HTML tags on report chart labels when using Relate fields
Go to line number 289 of the file include/SugarCharts/SugarChart.php and replace the line
return $this->tab("".htmlspecialchars($value,ENT_QUOTES)."",$depth);
with
return $this->tab("".htmlspecialchars(strip_tags($value),ENT_QUOTES)."",$depth);
Related articles
- Daily Tip: New Plugin Integrates SugarCRM with WordPress (pressography.com)
SugarCRM: Change Calls and Meetings tab label
Create a file on custom/Extension/application/Ext/Language/ called en_us.lang.ext.php
Include the below lines
<php
$app_list_strings['moduleList']['Calls'] = 'New Calls Label'; $app_list_strings['moduleList']['Meetings'] = 'New Meetings Label';
?>
SugarCRM: Add custom module to Related To drop-down
Create a new file custom/Extension/application/Ext/Language/.lang.ext.php with the following line of code.
$app_list_strings['parent_type_display']['<MODULE_NAME>'] = '<MODULE TITLE>';
$app_list_strings['record_type_display']['<MODULE_NAME>'] = '<MODULE TITLE>';
$app_list_strings['record_type_display_notes']['<MODULE_NAME>'] = '<MODULE TITLE>';
The drop-down on Leads, Calls, Meetings, Notes, Tasks module will be changed.
Related articles
- Building on SugarCRM (oreilly.com)
- Is your CRM system meeting your enterprise’s needs? (infoworld.com)
ACT the database could not be accessed
Receiving the error:
The database could not be accessed. In order to access this database, check your networkconnection and verify that your database server is available. It may be necessary to disable andy firewall software on you computer or the server.
The 2 most likely causes on a standalone are a damaged or invalid .pad file or SQL is not running, or is damaged.
.PAD file
- Close ACT!
- Click your Windows Start button, choose Run and type in actdiag
- When ACT! Diagnostics comes up, click Databases, the Database List
- Locate your database in the list, right-click on it and select Detach. Make sure you know the filepath to your database before detaching it.
- When the database has been detached, open My Computer (or Windows Explorer) and browse to the location of your database.
- Locate the .PAD file for your database [database name].pad and delete it
- Reopen ACT!…you will get a message that the last database opened cannot found, then will be taken to the Open Database dialog box
- At the bottom of this box, change the Files of Type to .adf, browse to the location of your database and double-click on the .adf file for your database
- You will get a message that ACT! will verify your database, click OK and ACT! will reattach your database to SQL and create a new .pad file
- Close ACT!
- Click on your Windows Start button, select run, and type in services.msc
- When the list of Local Services comes up, scroll down and locate the service called SQL Server (ACT7)
- Look in the Status column and make sure it says Started…if not, then right-click on the service and select Start
install vim on centos
yum install vim wont work on the CentOs server. First search for the versions of vim on the server using
yum search vim
The result can be something similar to below:
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirror.steadfast.net
* extras: centos-distro.cavecreek.net
* updates: centos.mirror.lstn.net
Reducing CentOS-5 Testing to included packages only
Finished
================================= Matched: vim =================================
vim-X11.x86_64 : The VIM version of the vi editor for the X Window System.
vim-common.x86_64 : The common files needed by any version of the VIM editor.
vim-enhanced.x86_64 : A version of the VIM editor which includes recent
: enhancements.
vim-minimal.x86_64 : A minimal version of the VIM editor.
Now use the below code to install the vim editor
yum install vim-enhanced.x86_64

