CRM Open Source Business & Social CRM Software

Results 1 to 7 of 7

Thread: How to connect my customized Field to another DB?

  1. #1
    ptctaji is offline Member
    Join Date
    Jan 2009
    Posts
    15

    Default How to connect my customized Field to another DB?

    Hi Best Developers!.
    I have created new fields in Contacts Module and I want to connect my new fields to SQLServer DB instead of default mysql db.
    Can I do this a how?

    Thanks a lot.

  2. #2
    letrium is offline Sugar Community Member
    Join Date
    Dec 2008
    Posts
    614

    Default Re: How to connect my customized Field to another DB?

    Hi!

    I think it is better to define function for new fields in vardefs.

    Do you know something about this.

    I may post an example if you need. Just ask!


    Best regards,

  3. #3
    ptctaji is offline Member
    Join Date
    Jan 2009
    Posts
    15

    Default Re: How to connect my customized Field to another DB?

    Hi.
    Please give me an example of this.

    Thanks a lot

  4. #4
    letrium is offline Sugar Community Member
    Join Date
    Dec 2008
    Posts
    614

    Talking Re: How to connect my customized Field to another DB?

    Hi!

    1.First of all you need to define field:

    PHP Code:
    'my_field' =>
      array (
        
    'required' => true,
        
    'name' => 'my_field',
        
    'vname' => 'LBL_MY_FIELD',
        
    'type' => 'varchar',
        
    'len' => '100',
       [
    B'function' =>
        array (
          
    'name' => 'getMyRez',
          
    'returns' => 'html',
          
    'include' =>'custom/MyFunc/func.php',

        ),[/
    B]
      ), 
    so, new for you is:

    'function' =>
    array (
    'name' => 'getMyRez', - this function will return value
    'returns' => 'html', - type of result
    'include' =>'custom/MyFunc/func.php', - file whitch contain this function

    ),

    2. Add to all layouts that you need

    simply:

    PHP Code:
    array('my_field'), 
    3.create file 'custom/MyFunc/func.php'



    PHP Code:
    if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');

    function 
    getMyRez($focus,$name,$value,$view){

    if(
    $view == 'DetailView' ){ 

       
    $rez your script result for detail view.

    }elseif(
    $view == 'EditView' ){

       
    $rez your script result for edit view.

    }if(
    $view == 'ListView' ){

       
    $rez your script result for  list view.

    }

    return 
    $rez;

    there :

    $focus - object
    $name - field name
    $value - field value
    $view ( editview, listview, detailview)


    That's all!

  5. #5
    mvngti is offline Sugar Community Member
    Join Date
    Oct 2007
    Location
    South Africa
    Posts
    510

    Default Re: How to connect my customized Field to another DB?

    letrium - THANKS!

    Finally a good example of using a function to render a field in the forums.
    Would you consider posting the example and some comments to the Wiki?
    (In respond to SugarDev.net's request to help with the Wiki)


    M
    --


    Marnus van Niekerk

    There are only 10 types of people in the world
    those who can read binary and those who don't

    Modules:
    CE Teams - Upgrade safe teams module for Community Edition
    FieldACL - Field Level Access Control for Community Edition
    EditLogicHooks - Create and edit Logic Hooks from the Admin GUI
    FlexibleChartDashlet - Display any data in a Dashlet Chart
    DocumentThumbnails - Thumbnails for Documents module

    Many questions can be answered by reading the Developers Manual

  6. #6
    letrium is offline Sugar Community Member
    Join Date
    Dec 2008
    Posts
    614

  7. #7
    ptctaji is offline Member
    Join Date
    Jan 2009
    Posts
    15

    Default Re: How to connect my customized Field to another DB?

    Hi!
    Thank you for this information.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Customized opt-out message
    By maggie.d in forum Marketing/Campaign Management
    Replies: 8
    Last Post: 2010-09-25, 04:49 AM
  2. Replies: 3
    Last Post: 2008-04-23, 01:38 PM
  3. Replies: 3
    Last Post: 2008-04-22, 12:09 AM
  4. Customized field, Upload file
    By Heilong in forum Help
    Replies: 2
    Last Post: 2008-01-22, 06:01 AM
  5. how do you add a customized field with sort facility?
    By TFG in forum General Discussion
    Replies: 0
    Last Post: 2006-02-14, 11:20 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •