SugarCRM Module Loader Issue

When trying to unload a new module I kept getting a bank screen, and errors in sugarcrm.log. The upload uses sys_get_temp_dir() to get the temp directory and this was set outside the document root, hence the error.

But how do yo set the system temp directly? Finally I tracked it down. You need to add the following to the php.ini file. You think it would be there, commented out, like lots of other parameters.

sys_temp_dir = "/Users/gregambrose/tmp"

Obviously, restart apache.

I hope that helps somebody

Greg

SugarCRM Relationships

There are plenty of examples on-line of working with relationships between modules in Sugar using load_relationship, but one problem I’ve recently solved is, how do you know the name of the relationship you want to load. Contacts, Cases etc are easy but there are lots of others you may be interested in.

Well the answer is simple, so long as you can debug your code with something like X-debug. If you can’t you should be as it makes life for a developer very easy.

load_relationship is within the SugarBean class (data/SugarBean.php). Step into it and break just after this line.

$fieldDefs = $this->getFieldDefinitions();

Now look through all the $fieldDefs until you find the relationship you are interested in. I’m interested in membership, so this is the one I want. The {name} is what you use {relationship} is the name you will see when you look at relationships in Studio.

I hope this helps someone.