Formula builder in SugarCRM
Posted By: Doddy.Amijaya on December 4th, 2013 in SugarCRM
No Gravatar

Recently I came across a strange behavior on SugarCRM formula builder.
What I wanted to do is Hide/Show fields based on other field condition.
In studio I checked the Dependent checkbox and I add the condition like so for my Status textbox

equal($stage_complete_c, "true")

My Status text box will be visible if $stage_complete_c = true.
So far so good. The textbox is indeed hidden if the $stage_complete_c = false and will appear when the value = true.
However this only applies to the EditView which is pretty strange.
When I click the save button and I go to DetailView my Status textbox is still hidden eventhough $stage_complete_c value = true.

The solution that I came up with is this

not(equal($stage_complete_c, "false"))

Now my Status text box will appear on both DetailView and EditView when the $stage_complete_c value = true.
Basically it’s doing the same thing and I don’t know why this one work and the other doesn’t

Customizing Line Item in SugarCRM in upgrade safe manner
Posted By: Doddy.Amijaya on October 25th, 2013 in SugarCRM
No Gravatar

I came across this request not too long a go and it did take a while for me to figure out. Now I’d like to share it with you guys hopefully this will save your hours of researching.
I used Aptana as my text editor because I need to reformat the minified Quotes.js

there are 6 files that you have to modify (7 if you would like to customize print to pdf feature as well):
1. Quotes.js (this is where you’d create the line items form)
2. EditView.js (This is to update the value)
3. editviews.php (this is where you would reference the EditViewFooter.tpl)
4. view.edit.php (this is to set the line items value)
5. EditViewFooter.tpl (this is where you reference the Quotes.js)
6. DetailViewFooter.tpl (this is the detail view of line items form)
7. sugarpdf.standard.php (this is to export to pdf)


SugarCRM – Menu Items Open in a New Tab/Window
Posted By: Alex.Cottner on February 15th, 2011 in General, Programming, SugarCRM
No Gravatar

The following is a simple example of making a menu item in SugarCRM (an item from a menu.php file) open in a new window. I needed a simple solution for this in order to integrate JasperReports Server.

$module_menu[]=Array("#\" onClick=\"'your_url_here');", $mod_strings['LNK_NAME'],"Image_Name", 'Module_Name');


Lock down the Mass Update form
Posted By: Alex.Cottner on February 10th, 2011 in Programming, SugarCRM
No Gravatar

Something that I find very quirky with Sugar is the fact that they allow the Mass Update form to be accessible for all users. This can cause serious problems with data integrity if you let end users have the kind of power this form has.

When browsing Sugar’s forum I see topics all the time about how to remove or lock down the mass update form based on specific users, teams, or remove it entirely. There are a couple of different ways of doing this. A few include non-upgrade safe ways because we have to modify core files, and 1 is an upgrade safe way.


Logic Hook to update field from another table
Posted By: Alex.Cottner on February 4th, 2011 in SugarCRM
No Gravatar

In this example, i am checking to see if the current contract i’m viewing is tied into any opportunity. If it does have an opportunity associated with it, than the start date for the contract will be set to the custom date field from the Opportunity.

So in all, this is 4 tables you are dealing with.
1. contracts
2. contracts_opportunities
3. opportunities
4. opportunities_cstm

First you setup your logic_hooks.php file under your custom/modules/Contracts directory. You will need to make sure that this is done in the after_save event as the before_save will not fire off the sql query (ignore the references of the names as before_save_logic as i was too lazy to go back in and change all of them).