How open subpanel quickcreate form without top_buttons array - sugarcrm

Sugar CRM 6.5
Need to open subpanel quickcreate form from custom bottons in the list_fields (not from top_buttons), something like this:
...
'list_fields' =>
array (
'quick_create' =>
array (
'vname' => 'LBL_QUICK_CREATE',
'widget_class' => 'SubPanelTopCreateButton',
'width' => '3%',
),
...

Related

Creating an Advanced Search field capable of searching multiple module fields

I am currently encountering issues trying to build a custom search field (itself bound to an unused field on a Module) to search two Phone Number fields. The documentation covering modifications of a search field are really poor, but I have the following in place in the module's SearchFields.php
'phone' =>
array (
'query_type' => 'default',
'operator' => '=',
'db_field' =>
array (
0 => 'home_phone_c',
1 => 'work_phone_c',
),
),
The field itself returns no results, so am I missing something that would prevent this from working?
why not you use "sub-query" operator for this? See SearchFields.php inside metadata folder of Account module. You will see entry like following:
'email' =>
array (
'query_type' => 'default',
'operator' => 'subquery',
'subquery' => 'SELECT eabr.bean_id FROM email_addr_bean_rel eabr JOIN email_addresses ea ON (ea.id = eabr.email_address_id) WHERE eabr.deleted=0 AND ea.email_address LIKE',
'db_field' =>
array (
0 => 'id',
),
'vname' => 'LBL_ANY_EMAIL',
),
this will help you to understand the sugar logic of doing it.
You need to designate the correct tables. Try the below code (or use the tables that you're searching):
'phone' =>
array (
'query_type' => 'default',
'operator' => '=',
'db_field' =>
array (
0 => 'accounts_cstm.home_phone_c',
1 => 'accounts_cstm.work_phone_c',
),
),

In suiteCRM how does one get about changing the Address field country and state text fields to be dropdowns?

I am developing a custom suite CRM module however I find the Address field limiting since it uses text fields for country and state fields.
I have tried researching it by following instructions on this site:
https://johndopenotes.wordpress.com/2013/01/08/sugarcrm-change-address-state-and-country-to-dropdown-menu/
However I am stuck at step 5 since my custom module does not have a metadata directory???
Go to /custom/modules/Leads/metadata and update editviewdefs.php. Look for this code:
array (
'name' => 'primary_address_street',
'hideLabel' => true,
'type' => 'Address',
'displayParams' =>
array (
'key' => 'primary',
'rows' => 2,
'cols' => 30,
'maxlength' => 150,
),
),
1 =>
array (
'name' => 'alt_address_street',
'hideLabel' => true,
'type' => 'Address',
'displayParams' =>
array (
'key' => 'alt',
'copy' => 'primary',
'rows' => 2,
'cols' => 30,
'maxlength' => 150,
),
),
and update the type from Address to CustomAddress
array (
'name' => 'primary_address_street',
'hideLabel' => true,
'type' => 'CustomAddress',
'displayParams' =>
array (
'key' => 'primary',
'rows' => 2,
'cols' => 30,
'maxlength' => 150,
),
),
1 =>
array (
'name' => 'alt_address_street',
'hideLabel' => true,
'type' => 'CustomAddress',
'displayParams' =>
array (
'key' => 'alt',
'copy' => 'primary',
'rows' => 2,
'cols' => 30,
'maxlength' => 150,
),
),
Can someone please give me a pointer as to how I can make address field in my custom module dropdowns instead of text fields?
Instead to choosing Address type field you can use combination of multiple fileds. For an example for street address you can use (datatype:textField)
Similarly for city you can add a text filed. Now for state and country you can use dropdown and add dropdown list as per your need
And for zipcode you can use integer / text field as per your requirement.
Now to make state dependend to country you can use custom javascript / jquery in following way
Add a reference to the javascript file you are going to add at the
end of custom/modules/<>/metadata/[edit|detail]viewdefs.php
$viewdefs['Opportunities']['EditView']['templateMeta']['includes'] = array ( array ( 'file' => 'path/to/file/filename.js', ), );
Add the javascript file you want to include into the location you
referenced above.
Quick Repair from the admin section, then browser refresh
It should just be a case of updating the vardefs for the field so the type is set to enum and the options point to your dropdown list. Then run a repair and rebuild.
The guide you've linked to looks like it is creating a new field type, which I think is overkill. It's also using Sugar logic to make the 2 lists dependent, but I'm not sure that's a feature in SuiteCRM.

fire an onchange event in select form control in drupal 7 forms api

I have a select form control in Drupal 7. How to call a function to whenever onchange event fires.
This is my select form control code:
$form['id']['signature'] = array(
'#type' => 'select',
'#options' => array(
0 => t('Browse...'),
1 => t('Sign...'),
2 => t('Clear...'),
),
);
You could probably do it with '#attibutes'.
eg.
$form['id']['signature']['#attributes'] = array('onchange' => array('myFunction()'))
Though I never like adding event attributes to html tags, so you could also probably do it by adding inline (or extenal) javascript to the form with a behavior like this:
$form['id']['signature'] = array(
'#type' => 'select',
'#options' => array(
0 => t('Browse...'),
1 => t('Sign...'),
2 => t('Clear...'),
),
'#attributes' => array(
'id' => array('signature-goes-here'),
),
);
$form['id']['signature']['#attached']['js'][] = array(
'data' => "
Drupal.behaviors.signature = function (context) {
$('#signature-goes-here', context).change(function () {
// Do stuff here.
});
}
",
'type' => 'inline',
);
But if you wanted to fire ajax when this form item changes, you would probably use the Drupal form api functionality.

From Where SugarCRM assign value for $fields.date_modified

From Where SugarCRM assign value for $fields.date_modified
Just wanted to see the sugar code and want to do some customization in that file
Below code is from : modules\Leads\metadata\detailviewdefs.php
'LBL_PANEL_ASSIGNMENT' =>
array(
array (
array (
'name' => 'assigned_user_name',
'label' => 'LBL_ASSIGNED_TO',
),
array (
'name' => 'date_modified',
'label' => 'LBL_DATE_MODIFIED',
'customCode' => '{$fields.date_modified.value} {$APP.LBL_BY} {$fields.modified_by_name.value}',
),
),
array (
array (
'name' => 'date_entered',
'customCode' => '{$fields.date_entered.value} {$APP.LBL_BY} {$fields.created_by_name.value}',
),
),
),
What SugarCRM version are you using?
I only have a pro version here.
Look for the following line on EditView2.php file under include/EditView directory.
$this->th->ss->assign('fields', $this->fieldDefs);
It is not advisable to modify core codes on sugarcrm. You might as well create a custom view.detail.php file custom/Leads/ directory. I assume you are new to sugar and the following link would be very helpful to you. http://archive.h2ik.co/2012/03/sugarcrm-upgrade-safe-way-to-extend-views/

Create a subpanel to a flex related module in sugarcrm

I followed that tutorial ( http://developer.sugarcrm.com/2011/05/16/howto-create-a-flex-relate-for-other-modules/ ) to create a flex related module between the Leads and the Accounts module and PRO_Profil module.
One account can have multiple PRO_Profil items. Same for the lead module, it can have multiple PRO_Profil items. In the table pro_profil, there is a creation of parent_id and parent_name
Then I follow that tutorial ( http://developer.sugarcrm.com/2011/05/18/howto-add-a-subpanel-using-code/ ) to create a subpanel.
But the subpanel are not shown on the account detail view and neither in the lead detail view.
This result with the creation of 2 files
custom\Extension\modules\Leads\Ext\Layoutdefs_profil.php
<?php
$layout_defs["Leads"]["subpanel_setup"]['PRO_Profil'] = array (
'order' => 130,
'module' => 'PRO_Profil',
'get_subpanel_data'=>'PRO_Profil',
'sort_order' => 'asc',
'sort_by' => 'name',
'subpanel_name' => 'default',
'title_key' => 'LBL_TEST_FLEXPARENT',
);
?>
custom\Extension\modules\Leads\Ext\Vardefs\infos.php
<?php
$dictionary['Lead']['fields']['PRO_Profil'] = array(
'name' => 'PRO_Profil',
'type' => 'link',
'relationship' => 'profils_leads',
'module' => 'PRO_Profil',
'bean_name' => 'PRO_Profil',
'source' => 'non-db',
'vname' => 'LBL_TEST_FLEXPARENT',
);
?>
I have the feeling that sugarcrm 6.3 or 6.4 changed the system
where is the problem ?
regards
I tryied also :
http://forums.sugarcrm.com/f148/howto-prospect-list-subpanel-leads-sugarcem-6-4-maybe-6-3-a-78030/