Results 1 to 9 of 9

Thread: Insert a lead via sql / how to create the id?

  1. #1
    Thomas.Pajonk is offline Sugar Community Member
    Join Date
    Feb 2006
    Posts
    20

    Question Insert a lead via sql / how to create the id?

    Hi all,



    I have to insert leads directly via sql. my question is, how must i create the unique i? Is there a sample?



    Best reagrds, thomas

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

    Default Re: Insert a lead via sql / how to create the id?

    use the auto_increment algorythm. that would be enough.
    Farkhad Rakhimzhanov
    E-mail: farkhad@gmail.com
    Skype: rakikama

    SuperTimesheet and Invoicing — timesheet tool with invoicing for SugarCRM.
    Book time against Cases, Project Tasks and Projects.
    Create invoice regarding booked time, print it in PDF or HTML,
    customize template as you like.

  3. #3
    Thomas.Pajonk is offline Sugar Community Member
    Join Date
    Feb 2006
    Posts
    20

    Default Re: Insert a lead via sql / how to create the id?

    Hi Superman!


    Could you please give me an example?


    Thaks a lot, Thomas

  4. #4
    HolmesA's Avatar
    HolmesA is offline Sugar Community Member
    Join Date
    Nov 2007
    Posts
    109

    Default Re: Insert a lead via sql / how to create the id?

    Hi

    Is it one time insert or you are developing some background logic in Sugar?

    Anyway you can use as ID any strings which will be created by some unique logic created by you directly in SQL. For example if you want to insert a Lead 'John Smith' the ID can be something like this: 'johnsmith20071212063523'. Where 20071212063523 is current datetime or you can use timestamps. Or you can add any other info about lead into ID to make it unique.
    Last edited by HolmesA; 2008-02-12 at 05:36 PM.

  5. #5
    Thomas.Pajonk is offline Sugar Community Member
    Join Date
    Feb 2006
    Posts
    20

    Default Re: Insert a lead via sql / how to create the id?

    Ok, if it´s this way, it helps me a lot. Thank you ver much for your help!

  6. #6
    gunni is offline Sugar Community Member
    Join Date
    Aug 2006
    Location
    Cologne, Germany
    Posts
    364

    Default Re: Insert a lead via sql / how to create the id?

    As stated above you can use every unique id as you like. If you want to know how the "original" sugar ids are created have a look at YOUR_SUGAR_DIR\include\utils.php in the function create_guid().
    As its quite simple function implementing it in sql is not that difficult.

  7. #7
    andopes's Avatar
    andopes is offline A Sugar Hero | Help Forum Moderator
    Join Date
    Jul 2006
    Location
    São Paulo - Brazil
    Posts
    8,335

    Default Re: Insert a lead via sql / how to create the id?

    Hi, all.

    I believe the SugarCRM id like can be created with MySQL store procedure, once it is an md5 hash in 5 blocks.

    Cheers.

    --
    André Lopes
    Lâmpada Global Services
    Rua Bela Cintra, 299 conjunto. 51
    São Paulo, SP 01415-000
    tel1. 55 11 3237-3110
    cel. 55 11 7636-5859
    e-mail: info@lampadacrm.com.br

  8. #8
    binuka is offline Junior Member
    Join Date
    Feb 2008
    Posts
    3

    Default Re: Insert a lead via sql / how to create the id?

    hay Guys..

    thanx a lot for the help..

    Cheers

  9. #9
    clint's Avatar
    clint is offline Sugar Team Member | Forums Lead Moderator
    Join Date
    Aug 2004
    Location
    Silicon Valley
    Posts
    2,120

    Default Re: Insert a lead via sql / how to create the id?

    Yep, all of these answers are correct. It simply needs to be a unique string. We use a function that creates a guid (globally unique id), but you can use an custom mechanism you want as long as you end up with unique values.
    Sugar Developer Zone - developer resources | Sugar University - user and admin training
    Sugar Docs - user and admin documentation |
    Sugar Bug Tracker - Enter or view bugs
    SugarForge- open source modules, themes, lang packs | SugarExchange - commercial extensions

    Clint Oram
    Chief Technology Officer and Co-founder
    SugarCRM

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 1
    Last Post: 2008-02-22, 04:25 PM
  2. 4.5.0d Can Create Lead assigned to others
    By kirkland in forum Help
    Replies: 33
    Last Post: 2007-03-10, 04:09 AM
  3. From lead to order
    By george_bbch in forum Feature Requests
    Replies: 0
    Last Post: 2006-09-26, 02:02 PM
  4. HTTPUnit Create Lead...
    By rje in forum Developer Help
    Replies: 0
    Last Post: 2005-12-20, 04:12 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
  •