Results 1 to 5 of 5

Thread: Creating autoincrement custom field

  1. #1
    joshmark is offline Member
    Join Date
    Dec 2006
    Posts
    9

    Default Creating autoincrement custom field

    Hi All!

    I'm pretty new to the SugarCRM world and exploring out the possibility of using it in our organization (a NGO) for contact management. Can any one suggest me a way to add an auto increment field in contacts module which I want to use as a unique contact identifier. I want the contact identifier to be human readable as we would be giving these to our contacts.

    Please guide me as what will be the best way to do this.

    Thanks for all your help.

    Joshua

  2. #2
    dtokeefe's Avatar
    dtokeefe is offline Sugar Community Member
    Join Date
    Mar 2005
    Location
    Sao Paulo, Brasil
    Posts
    671

    Default Re: Creating autoincrement custom field

    You could just add an autoincrement field to the contacts table, although you might discover that it's better and easier to stick with the existing id field. It would be difficult and pointless to rework Sugar to use auto-increment for ids. Just adding the field and adapting the Contacts class is fairly simple with no major consequences, except for upgrading in the future.

    David
    David O'Keefe
    Lampada Global Services
    SugarCRM Gold Partner
    USA: +1 908 998-2278
    BR: +55 11 3237-3110
    Skype: dtokeefe
    Email: equipe@lampadaglobal.com
    www.lampadaglobal.com

    Lampada Global delivers enterprise software and offshore programming services to customers around the world.

  3. #3
    lvangool is offline Sugar Community Member
    Join Date
    Jul 2006
    Location
    Near Rotterdam, Holland
    Posts
    280

    Default Re: Creating autoincrement custom field

    I think it's wiser to leave the existing ID system intact throughout Sugar. Of course, you can still create another field with the human readable ID in it. Since SugarCRM isn't flexible with databases, I would suggest that you just add a custom INT field to the Contacts module and rework the Contacts class to auto increment this ID everytime you add a contact.

  4. #4
    andydreisch's Avatar
    andydreisch is offline Sugar Team Member
    Join Date
    Apr 2005
    Location
    San Jose
    Posts
    2,080

    Default Re: Creating autoincrement custom field

    Quote Originally Posted by lvangool
    ... Since SugarCRM isn't flexible with databases...
    lvangool, can you expand on this? I'm not sure what you mean by this.

    Thanks,

    Andy
    Andy Dreisch
    Vice President, Online Team


    Check out our Podcasts!
    Sugar University for training
    Sugar Wiki for developer and user help
    SugarForge for modules, themes, lang packs
    SugarExchange for production-ready extensions
    Enter/view bugs via the Sugar bug tracker

  5. #5
    mycrmspacegunnar is offline Sugar Community Member
    Join Date
    Sep 2006
    Posts
    105

    Default Re: Creating autoincrement custom field

    Quote Originally Posted by lvangool
    I think it's wiser to leave the existing ID system intact throughout Sugar. Of course, you can still create another field with the human readable ID in it. Since SugarCRM isn't flexible with databases, I would suggest that you just add a custom INT field to the Contacts module and rework the Contacts class to auto increment this ID everytime you add a contact.
    There are two possibilities to create such an autoincrement value.
    A) adding the field to the main contacts table
    This has the advantage that this number will always and automagiclay by given by the mysql database.
    The drawback is that you will NOT see this field in the studio editor and you will need to manually add it to the detail view and edit view.html templates.

    B) you can create the field as custom field. You can to this by first creating an simple int field and then changing it with a database tool to autoincement . The advantage of this solution is that you will be able to see and place this field in the studiui editor. The major disadvantage is that the field will NOT reliable be assigned by Sugar and MySQL.
    If you create any records that do not contain other customs field (e.g importing data, contacts created by soap) then id field will NOT be created. You will need to alter the Sugar sources to ensure this.

    If you really need this field then I would recomment to use option a) and add the field to the main "contacts" table.
    You will certainly find manual hacking of the detailview template being much easier than altering the sources of the contacts class.

    Cheers
    Gunnar
    Gunnar von Boehn
    myCRMspace

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. problemi step 6 di SugarSuite-Full-4.0.1h
    By lucia in forum Italiano
    Replies: 0
    Last Post: 2006-12-27, 08:50 AM
  2. Replies: 1
    Last Post: 2006-10-12, 12:07 AM
  3. 4.0.1 Installation Problem
    By clawton in forum Help
    Replies: 14
    Last Post: 2006-02-13, 04:17 PM
  4. Fatal error: Max
    By spokes2k4 in forum Help
    Replies: 3
    Last Post: 2006-01-15, 03:50 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
  •