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);
?>
Advertisements
SugarCRM: Dynamically create dropdown values

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s