开发者

Adding a custom field type to SugarCRM?

开发者 https://www.devze.com 2023-03-08 10:48 出处:网络
I\'m trying to add a custom field type to our SugarCRM 6.2 instance. I want to add an \"email link\" type field. I want it to function like the URL field, but prefi开发者_JS百科x every address with \"

I'm trying to add a custom field type to our SugarCRM 6.2 instance. I want to add an "email link" type field. I want it to function like the URL field, but prefi开发者_JS百科x every address with "mailto://" prefix instead of "http://".

It will be good if that field type is available in studio while creating new fields or in minimum, some custom code to achieve it.

What I did up to now: - I've copied include/SugarFields/Fields/URL to include/SugarFields/Fields/Email - In modules/ModuleBuilder/language/en_us.lang.php I've added a title for the email field

But unable to get anything working. Any help?


First of all you do not want to make any coding changes outside of the custom directory. Doing so outside of this directory is not upgrade safe.

  1. Create a custom fields directory in your custom folder
  2. Create new template files (.tpl) for your custom field

then you can just add a regular textfield in studio then edit your viewdefs in your custom directory in your tpl file concatenate the mailto:// to your text and just add the persons email address and it will take care of the rest for you


why you need custom field type for such small functionality? Just add your custom JS file in editviewdef.php. Then use some jQuery selector to perform certain action. For detail view, you can use view.detail.php to add required text in run time.

This will help you to store less data in database and display more in frontend.

0

精彩评论

暂无评论...
验证码 换一张
取 消