Last active
July 30, 2019 03:32
-
-
Save spinegar/6124727 to your computer and use it in GitHub Desktop.
Joe_______'s SugarCRM Cheat Sheet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sugarwiki | |
Adding a Field to the Modules Subpanels „ Popup Search “ definitions | |
Code way: | |
1. Use metadata/popupdefs.php (custom folder, if there is none copy original) | |
2. Seek section searchdefs' => array(…) | |
3. Add field to searchdefs | |
Or Studio way: | |
Admin > Studio > Contacts > Layouts > PopupView > Popup Search | |
Subpanel Query Change with custom fields | |
1. Open subpanel def | |
2. Use ‘where’ clause | |
3. Query mysql like “contacts.id in ( select id_c from contacts_cstm where contact_roles_c ='past' )” | |
If this fails remember this: | |
Sugar will make a mess of your subquery. There’s an easy solution. Sugar handles query rewriting based on the strings “where” or “WHERE”. So, all you need to do is write your “WHERE” in mixed case, like so: | |
"where" = "id in (select id from some_table WhErE field='xyz')" | |
Subpanel Query through code | |
1. http://forums.sugarcrm.com/f6/displaying-meetings-related-contact-account-s-subpanels-69335/ | |
Subpanel Change Top Buttons | |
1. Edit the file custom/Extension/modules/<CustomModule>/Ext/Layoutdefs/<filename> | |
2. Replace the top_button "SubPanelTopCreateButton" by "SubPanelTopButtonQuickCreate"(or your button) | |
3. Go to Admin -> Repair -> Rebuild Extensions | |
SubPanel pass Data to quick create | |
1. http://forums.sugarcrm.com/f6/passing-data-subpanel-quick-create-43774/ | |
ListView add own action | |
1. http://developers.sugarcrm.com/wordpress/2010/11/22/howto-adding-your-own-listview-action-items/ | |
Create Custom Action | |
1. create a file in custom/modules/{MODULE}/ called "controller.php". | |
Here is an example of a custom controller.php | |
2. <?php | |
3. | |
4. class CustomContactsController extends SugarController | |
5. { | |
6. public function action_MyActionName() | |
7. { | |
8. $record = $_REQUEST['record']; | |
9. //do something with the record here | |
10. | |
11. } | |
12. } | |
In this function you have access to the entire SugarCRM API. You can create and update Sugar Beans, or run queries directly on the database, using the global "$db" object. | |
Custom Sugar View | |
1. http://www.panchjanyacorp.com/parth/sugarcrm/sugarcrm-the-sugarview-creating-and-using-views-in-sugarcrm/ | |
Custom Sugar Ajax View | |
1. http://developers.sugarcrm.com/wordpress/2012/12/21/creating-a-view-designed-to-return-ajax/ | |
ListView add related Field | |
1. http://developers.sugarcrm.com/wordpress/2012/03/13/howto-grab-fields-from-a-related-record-without-sugar-logic/ | |
Custom Editview template | |
You would need to add a view.edit.php file in each module you want to use your template, overriding the preDisplay() method like so: | |
PHP Code: | |
function preDisplay() | |
{ | |
parent::preDisplay(); | |
$this->ev->tpl = 'yourtplfile.tpl'; | |
} | |
Alternate Subpanel layout | |
1. Create subpanel LAyout File in modules/subpanels/metadata For instance "ForEvents"; | |
2. Then go to module Layout definition: | |
3. //custom Ext Layoutdefs layoutdefs.ext.php | |
4. Change Subpanel name to your PanelDefinitionfilename for instance "ForEvents" | |
Dynamic number of items in Subpanel | |
1. https://github.com/sugarcrm/sugarcrm_dev/pull/141/files | |
2. + next if clause find -> $limit = $sugarconfig….records per page Replace with: | |
3. PHP Code: | |
if ($subpanel_def->_instance_properties['records_per_page']) { | |
$limit = $subpanel_def->_instance_properties['records_per_page'] + 0; | |
} else { | |
$limit = $sugar_config['list_max_entries_per_subpanel']; | |
} | |
$focus to realname | |
To override a module view class use | |
Custom<module>ViewEdit extends <module>ViewEdit | |
Log Objects | |
$GLOBALS['log']->error("handling contat= ". print_r($ListContact, true)); | |
Subpanel Filter | |
http://developers.sugarcrm.com/wordpress/2012/12/06/creating-a-subpanel-filter/ | |
Display SugarActionmenu as Buttons not as dropdown | |
admin > system settings > display actions within menus > uncheck | |
Dynamically Collapsing Subpanels Based on Record Values | |
http://support.sugarcrm.com/02_Documentation/04_Sugar_Developer/Sugar_Developer_Guide_6.5/03_Module_Framework/06_Subpanels/Examples/Dynamically_Collapsing_Subpanels_Based_on_Record_Values | |
Adding QuickSearch to a custom field | |
http://support.sugarcrm.com/02_Documentation/04_Sugar_Developer/Sugar_Developer_Guide_6.5/03_Module_Framework/02_Metadata/Examples/Adding_QuickSearch_to_a_custom_field | |
Creating a Custom Sugar Field | |
http://support.sugarcrm.com/02_Documentation/04_Sugar_Developer/Sugar_Developer_Guide_6.5/03_Module_Framework/02_Metadata/Examples/Creating_a_Custom_Sugar_Field | |
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
http://forums.sugarcrm.com/f6/how-enable-disable-create-sub-panel-button-depending-field-value-68262/ | |
Programmatically Find the Name of the Relationship between two Modules | |
http://developers.sugarcrm.com/wordpress/2013/05/29/programmatically-find-the-name-of-the-relationship-between-two-modules/ | |
Setting up memcache with Sugar on Windows | |
http://developers.sugarcrm.com/wordpress/2013/04/29/setting-up-memcache-with-sugar-on-windows/ | |
SugarCRM: Create a custom javascript validation before saving in Edit view | |
http://johndopenotes.wordpress.com/2013/02/05/sugarcrm-create-a-custom-javascript-validation-before-saving-in-edit-view/ | |
Use Sugarfields in Custom View | |
http://urdhva-tech.blogspot.de/2013/03/create-controls-sugar-way.html | |
Display a Statusmessage using AJAXUI | |
// Display a message to the user before the action | |
ajaxStatus.showStatus('Message to display while doing the action'); | |
ajaxStatus.hideStatus(); | |
Show Loadingscreen AJAXUI | |
SUGAR.ajaxUI.showLoadingPanel(); | |
SUGAR.ajaxUI.hideLoadingPanel(); | |
Prevent a Logic Hook From Running Multiple Times | |
https://www.sugaroutfitters.com/blog/prevent-a-logic-hook-from-running-multiple-times | |
Have a Subpanel QuickCreate refresh after the record is saved. | |
http://developers.sugarcrm.com/wordpress/2012/12/10/have-a-subpanel-quickcreate-refresh-after-the-record-is-saved/ | |
Admin Pages for Custom modules | |
http://www.profilingsolutions.com/archive/quick-configuration-pages/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@spinegar I have cleaned this gist with Markdown incase you need little bit more clarity :)
https://gist.github.com/rajeshvaya/0f9f032c73b1ab159189