PHP, SugarCRM, Javascript, Cool Web Apps Developer


view:  full / summary

Fetch Current User Id - Sugar 7

Posted by swapnil shinde on October 5, 2014 at 10:30 AM Comments comments (0)

From any of the javascript you have included in sugar crm's view hit following code response will give you the info you need.


    App.api.buildURL( 'me' ),


    success: _.bind( function( objCurrentUser ) {


    }, this )


Create Document in Sugar

Posted by swapnil shinde on December 11, 2012 at 12:10 AM Comments comments (0)

We can create or upload the document in sugarcrm using soap.

I was finiding a way to create a doc from backend. right now its from raw PHP code, I will post the code based on Sugarcrm's convention, I mean using objects soon.

Here is the code.

if(!defined('sugarEntry')) define('sugarEntry',true);


global $db;


Read Full Post »

Add form Validation SugarCRM

Posted by swapnil shinde on July 19, 2012 at 1:40 AM Comments comments (3)


I have seen and encountered with issues like we need to do a validation that is out of box of SugarCRM.

For e.g. we have addToValidateDateBefore which works or invokes like

if you add it on date1 and to be validated with date 2, then it will work only if date1 is newer than date2, but we need to show error if date 1 is older than date2.

We can do our normal custom coding to verify these dates but question is how do we show errors in Sugar's fashion (a red colo...

Read Full Post »

Create Object and Retrieve record by creating Object.

Posted by swapnil shinde on March 26, 2012 at 4:05 AM Comments comments (0)


So many times we need to create records into related modules so instead of inserting records into their tables and its custom table we can create the object of that module and call its function save().

So once u call that function it will also execute its logic hooks as well.

so we just need to include the file of that module.




Read Full Post »

Find out Email Related to Account/Contact

Posted by swapnil shinde on February 15, 2012 at 7:55 AM Comments comments (0)

As Email for all the modules which are derived from Person Template/Type will be stored in Email Module. We can access this email by finding out relationship between module and email module.

Suppose you want to find Contact's email and you have its id(generated by sugar) then you can use following query to find out the email.

"select email_address

from email_addresses e, email_addr_bean_rel ec

where bean_id = '$contact_id'

and ec.email_address_id =

Read Full Post »

Customize Subpanel Buttons.

Posted by swapnil shinde on February 5, 2012 at 7:05 AM Comments comments (0)

To customize subpanel buttons.

Suppose we need to hide Create and Select buttons, or if we need to navigate quick create to full form. Then we need to follow following steps.

We need to first see the Subpanel's name.(which you can find out from studio/module/Relationships).

Navigate to custom/Extension/modules/Parent_Module/Ext/Layoutdefs

create one file like custombyswapnil.php.

and code like this.



Read Full Post »

Customize the export functionality for a module

Posted by swapnil shinde on January 31, 2012 at 3:30 PM Comments comments (0)

The easiest way to do this is by providing your own query to use in the module’s bean method create_export_query(), but this isn’t upgrade-safe for any of the out of the box modules. However, there is an upgrade-safe way to do this, although it’s a bit more indepth, which our resident Sugar Hero andopes points out below ( from this post ):


You can create the script custom/modules/Leads/entry_point_registry.php containing something like that:


Read Full Post »

Disable SugarCRM AjaxUI

Posted by swapnil shinde on January 31, 2012 at 3:10 PM Comments comments (2)

In version 6.3 of SugarCRM we are introducing a new method for loading pages that uses AJAX to load the html content rather than doing a full page refresh. This has some major impacts on performance.

You also have the option of totally disabling the AjaxUI with the following line. In config_override.php


just add line above in config_override.php

Using a relate field to populate a custom field

Posted by swapnil shinde on January 31, 2012 at 2:50 PM Comments comments (1)


In edit view of your module  once you select any record in relate field, if you want to populate any other field from same module then follow the following steps.

There are times a client requests, or common sense usability dictates the need to use a relate field to populate information related to a record. Often times, you can get away with an address or phone number; but there are times where you need to use a custom field.


The situation for our c...

Read Full Post »

Repair Rebuild through Code

Posted by swapnil shinde on January 31, 2012 at 2:40 PM Comments comments (9)

PHP Code:



$rac = new RepairAndClear();

$rac->repairAndClearAll(array('clearAll'),array(translate('LBL_ALL_MODULES')), false,true);