Results 1 to 2 of 2

Thread: Adding custom field when creating module.

  1. #1
    Superman's Avatar
    Superman is offline Sugar Community Member
    Join Date
    Oct 2005
    Location
    Kazakhstan
    Posts
    850

    Default Adding custom field when creating module.

    I've downloaded Song module. And there is an implementation of adding custom field to any Module.
    Exact example from Song:
    custom field label_company is added to Song module.

    When going to Edit page we can choose Account by clicking Select button.
    And then after successful Save, we can see the name of Account that we have just chosen on edit page.
    Still, there is a bug on a Detail page, link that leads us to Account is broken because record is empty.

    Well, the question.
    I created a module, indicated in manifest.php:


    ...
    'custom_fields' => array(
    array('name' => 'account_name',
    'label' => 'Account:',
    'type' => 'relate',
    'max_size' => 255,
    'require_option' => 'optional',
    'default_value' => '',
    'ext1'=>'name',//Field to get from To Module (Bugs)
    'ext2'=>'Accounts',//Relate To Module
    'ext3'=>'',
    'audited' => 0,
    'module'=>'MyModule', //Relate From Module
    ),
    ),
    );


    I must say, that after successful installation of my module I tried to test this custom field.
    I've indicated account name, pressed Save, and nothing was represented in the field Account, while corresponding record has been inserted in MyModule_cstm.

    What is wrong?

  2. #2
    Superman's Avatar
    Superman is offline Sugar Community Member
    Join Date
    Oct 2005
    Location
    Kazakhstan
    Posts
    850

    Default Re: Adding custom field when creating module.

    Well, my question is veru urgent, and i have had to dig in sugar source...
    And found a bug because of what custom field of data_type='relate' was represented incorrectly or was not represented at all.

    I'm using SugarCRM 3.5.1a

    You should open {sugar}/modules/DynamicFields/templates/Fields/TemplateRelatedTextField.php,
    and go to function get_xtpl_edit().

    So, in this function variable $beanList is used which is global, but it is not declared as a global here,
    now just

    function get_xtpl_edit()
    {
    global $beanList;
    ...
    }

    and everything is ok!

    PS: i'm happy as a child when solved that problem

Thread Information

Users Browsing this Thread

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

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
  •