CRM Open Source Business & Social CRM Software

Results 1 to 8 of 8

Thread: Howto add new field

  1. #1
    bogusman is offline Sugar Community Member
    Join Date
    Jan 2005
    Posts
    13

    Default Howto add new field

    I'm playing with the FIeld Layout page and think I understand how to put a new field on a particular form. Nice feature. But I don't imagine having a field without relevant data is of much use, so I must need to connect that field to something in the db. What's the process for doing this, or am I misunderstanding the process?

    Bo

  2. #2
    smueller72 is offline Sugar Community Member
    Join Date
    Jan 2005
    Posts
    125

    Default Re: Howto add new field

    I have the same question/problem. Also, I can't seem to 'publish' any new fields I add to a particular form. The new fields save fine and I can see them in the 'Studio' but they don't appear in the user interface itself. Perhaps related to the original question about how to 'tie' a db field to an added field? Any help would be greatly appreciated.

    Regards

  3. #3
    exobrain3000 is offline Sugar Community Member
    Join Date
    Jan 2005
    Posts
    42

    Default Re: Howto add new field

    But I don't imagine having a field without relevant data is of much use, so I must need to connect that field to something in the db. What's the process for doing this, or am I misunderstanding the process?
    If you are referring to adding a corresponding database column to match the custom field you created; then this is taken care of using the 'custom_field' table (if I remember correctly). Data entered into a custom field is placed in this table for all custom fields for all modules. It is an interesting design since it leaves then original tables intact while custom field data is joined with the original table via the GUID during data retrieval – although I can potentially foresee some performance implications with this approach vs. modifying the original table directly.

  4. #4
    smueller72 is offline Sugar Community Member
    Join Date
    Jan 2005
    Posts
    125

    Default Re: Howto add new field

    I do see that table. So do the fields need to be added to the db manually. I've added fields on the front-end but don't see the corresonding fields in the custom_fields table so apparently they have to be added manually or I've got something configured wrong. The next question would then be how do you 'tie' that db field to the newly added fields on the user interface? What am I missing here?

  5. #5
    exobrain3000 is offline Sugar Community Member
    Join Date
    Jan 2005
    Posts
    42

    Default Re: Howto add new field

    Quote Originally Posted by smueller72
    I do see that table. So do the fields need to be added to the db manually. I've added fields on the front-end but don't see the corresonding fields in the custom_fields table so apparently they have to be added manually or I've got something configured wrong. The next question would then be how do you 'tie' that db field to the newly added fields on the user interface? What am I missing here?
    The admin interface does not create columns as such but you do not need to 'tie' the field you created against the values in this table.

    I don't have the table in front of me, but the custom table has something like 9/10 columns/slots, each of these represent the custom value that is entered into the data entry form along with the GUID value on the same record to join with the original table. If you have more than 9 custom fields it will create an additional record allowing for 18/20 (and so on). Therefore the columns in the custom table are not named explicitly as per the custom field, only the values are stored in the pre-defined numbered columns.

    So when save a document which has a custom field values will be inserted into this table accordingly. You do not need to change anything in the database. You may want to check your installation for write permissions (I believe the custom field settings are stored in a directory called 'custom' or something) if it is still not working after adding a custom field via the user interface - since it should work without further intervention.

  6. #6
    bogusman is offline Sugar Community Member
    Join Date
    Jan 2005
    Posts
    13

    Default Re: Howto add new field

    Quote Originally Posted by exobrain3000
    So when save a document which has a custom field values will be inserted into this table accordingly. You do not need to change anything in the database.
    I think I get it. There appear to be 10 custom fields in the custom_fields table. As I create a new field to be put on one of the forms, presumably Sugar keeps track of them somehow and magically assigns them to these 10 fields.

    What if I need more than 10 fields? Can I add more fields to the custom_fields table and will Sugar find them ok? (I ask this because I know I'm going to be asked at some point in the future.) What about changing the size of the custom fields - 255 chars may not be enough. Of course, there are implications for future upgrades to consider. Yikes.

  7. #7
    smueller72 is offline Sugar Community Member
    Join Date
    Jan 2005
    Posts
    125

    Default Re: Howto add new field

    Ok - I've got the fields added and they are being displayed in the user interface - thanks everyone for your suggestions/help on how to accomplish this. Noooowwww... - I'm wanting to import account records from a .csv file and when I go to do so I don't see the custom fields available for importing into. Is this by design or am I missing something? Not having this would require me to manually update each account record after the import so any insight before I move forward would be greatly appreciated.

  8. #8
    exobrain3000 is offline Sugar Community Member
    Join Date
    Jan 2005
    Posts
    42

    Default Re: Howto add new field

    Quote Originally Posted by bogusman
    What if I need more than 10 fields? Can I add more fields to the custom_fields table and will Sugar find them ok? (I ask this because I know I'm going to be asked at some point in the future.)
    When there are more than 10 custom fields for the document, two records (with the same GUID data in bean_id column) will be inserted each time custom data is entered. The custom field capacity will be increased to 20. The application can differentiate these two records by the set_num field.

    Quote Originally Posted by bogusman
    What about changing the size of the custom fields - 255 chars may not be enough. Of course, there are implications for future upgrades to consider.
    It should be safe to convert these fields to text/mediumtext by altering the table. This is definately one of the weaknesses in the design since you have no idea how big your fields will be, the best you can do it allocate the biggest field possible to accomodate your biggest field. In some cases field0 might be assigned to a free text field in one document and one other it might be a checkbox (true/false) - inserting a boolean value into a text field is considerable waste, but this is unavoidable.

    Quote Originally Posted by bogusman
    Yikes.
    Yeah.

    Quote Originally Posted by smueller72
    I'm wanting to import account records from a .csv file and when I go to do so I don't see the custom fields available for importing into. Is this by design or am I missing something? Not having this would require me to manually update each account record after the import so any insight before I move forward would be greatly appreciated.
    This is most likely by design. It seems you cannot export or import custom fields. Probably want to raise an enhancement request.
    Last edited by exobrain3000; 2005-01-28 at 10:19 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. How to add a new field? (no custom field)
    By lahb80 in forum Developer Help
    Replies: 2
    Last Post: 2006-11-19, 11:43 AM
  2. Manually Add Field to contacts table
    By mlh in forum Developer Help
    Replies: 9
    Last Post: 2006-08-16, 11:53 PM
  3. Replies: 0
    Last Post: 2006-06-21, 08:47 PM
  4. Replies: 2
    Last Post: 2005-09-12, 09:10 PM

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
  •