Search: SugarCRM

Recently, someone on the forums asked about how to alter the list of modules shown in the dropdown portion of the Parent (“Relate to”) field.  Specifically, the post was about removing the Contacts module from the list of modules for the Meetings module.  What was happening was that some users were not sure how to add a user to a meeting and wound up using the “Related to” field to create this association when the business case assumed they would invite users instead.

There are probably a few ways to achieve this type of field customization functionality and here are two ways I thought of depending on your business requirements.  The first approach is if you really want to limit the options in this Parent field for all modules and all views, you could make a global change that would affect the SugarField everytime it is shown.  Here are the steps to achieve this:

1) Copy the EditView.tpl file from include/SugarFields/Fields/Parent to custom/include/SugarFields/Fields/Parent

2) Modify the custom EditView.tpl file at the top as follows (highlighted in bold)

{php}
global $app_list_strings;
$custom_options = $app_list_strings['record_type_display'];
if(isset($custom_options['Contacts']))
{
unset($custom_options['Contacts']);
}
$this->assign('custom_options', $custom_options);
{/php}

<select name='parent_type' tabindex="{{$tabindex}}" id='parent_type' title='{{$vardef.help}}'
onchange='document.{$form_name}.{{sugarvar key='name'}}.value="";document.{$form_name}.parent_id.value=""; {{sugarvar key='name'}}changeQS(); checkParentType(document.{$form_name}.parent_type.value, document.{$form_name}.btn_{{sugarvar key='name'}});'>
{html_options options=$custom_options selected=$fields.parent_type.value sortoptions=true}
...


3) Use Admin->Repair to clear out the cached .tpl files.  The next time the edit views are rendered, the dropdown for the Parent field will only display Accounts and Leads.

The second approach aims to limit this change to just the Meetings module.  In this case, I would consider using an edit view override to alter the contents of the parent options before it is displayed.  Here are the steps.

1) If you don’t already have a custom/modules/Meetings/views/view.edit.php file, copy the modules/Meetings/views/view.edit.php to the custom directory location.

2) Modify the view.edit.php file’s display method at the very end, change

parent::display();

to

$this->ev->process();
unset($this->ev->fieldDefs['parent_name']['options']['Contacts']); //Remove Contacts
echo $this->ev->display($this->showTitle);

 

What we’ve done here is to modify the parent_name variable’s Array.  By changing the options delta in the parent_name Array value to unset the Contacts delta, we effective remove the Contacts module from appearing in the list of the dropdown modules.  This change also limits the scope to the Meetings module.  I actually thought of looking for a solution with the EditView.tpl file itself to accomplish this, but I did not like the idea of altering a file that affects all modules when the customization is confined to just one module.

To recap, there are likely various ways to accomplish field display customizations in SugarCRM.  You should first determine if the field changes will apply to all modules for all views.  In that case, you could take the first approach outlined here.  If the scope of changes are limited to certain modules, you could take the steps outlined in the second example.

{ 0 comments }

Due to some irregular voting patterns over the past few hours, I’ve removed the voting on the previous post and instead changed it to use a poll hosted by micropoll. So to vote, please go to http://micropoll.com/t/KEvJaZB3sn instead. If you have voted previously, please go to that site to recast your vote. Voting will now close on Friday, July 8th at 12:00 midnight ET.

Sorry for the inconvenience. Good luck to all the projects!

{ 0 comments }

Check out “Extend SugarCRM REST web services to use XML” on IBM Developerworks

July 5, 2011

If you’ve wanted to learn about customizing and extending our Web Services API, check out the recent article I wrote for IBM DeveloperWorks “Extend SugarCRM REST web services to use XML“. This article talks about extending the Web Services API to use XML and an input and output data types, which can make it much [...]

Read the full article →

Vote for the July SugarForge Project of the Month

July 1, 2011

Thanks for the feedback from everyone this week on what projects you thought would be fit for the title of July 2011 SugarForge Project of the Month. We had one overwhelming favorite amongst the nominations, as well as a few other projects that have also made a good impact on the community as a whole. [...]

Read the full article →

HOWTO: Hide the create button added in 6.2

June 30, 2011

In 6.2 we added a nice usability feature that has a icon to create a record for a module on all pages of that module. If you aren’t as fond of such an button appearing on your module’s pages, you can hide it globally using a small piece of custom CSS, as pointed out by [...]

Read the full article →

July’s SugarCRM Community Webinar will be all about 6.3

June 29, 2011

Hot off the heels of Sugar 6.2 comes Sugar 6.3, codenamed “Cotton Candy”, that will include several projects coming from the very successful SugarCon Code Sprint back in April, as well as many fixes coming from our community. In this month’s meeting, our very own Senior Project Manager Jennifer Yim will detail and demo some [...]

Read the full article →

Having the blues upgrading to Sugar 6.2?

June 28, 2011

We’ve heard from the early adopters of Sugar 6.2 of a few issues seen during upgrade, namely: jssource/src_files/ directory gone after upgrade Silent Upgrade errors out ( PHP Fatal error: Call to undefined method RepairAndClear::clearExternalAPICache() in silentUpgrade_step2.php ) Certain customizations to the ‘templateMeta’ section of editviewdefs are not being preserved. Rest assured that we are working [...]

Read the full article →

SugarForge POTM is back, and we want to hear what you think it should be.

June 27, 2011

Since the beginning of SugarForge back in 2005, we’ve crowned a SugarForge POTM ( project of the month ) each month to recognize the most outstanding and innovative add-ons, plugins, and extensions created by our vast Sugar community. It has also been a showcase of how extensive the Sugar platform is, helping provide ideas on [...]

Read the full article →

We’re at the midpoint of the bug contest. Get your’s in today!

June 24, 2011

We are approaching the midpoint of the SugarCRM Community Bug Fix Contest, and the entries have been slowly trickling in this week. I know everyone has that one annoyance, bug, or issue they’ve reported that they would love to be fixed once and for all, and now it’s your chance to do so and possibility win an [...]

Read the full article →

Unit tests can create a false sense of security

June 23, 2011

At SugarCRM we use PHPUnit as our unit testing framework. I like to think we apply it pretty rigorously in terms of always pushing changes with unit tests attached where appropriate. One artifact of this is that unit tests can add a false sense of security. Here is a real world example. I wrote some [...]

Read the full article →