Results 1 to 5 of 5

Thread: Is it possible to have the same ID on diferent modules?

  1. #1
    leowolff is offline Sugar Community Member
    Join Date
    Apr 2009
    Posts
    126

    Default Is it possible to have the same ID on diferent modules?

    Hello, is it possible that an ID of a custom module could be the same as an ID from account module?
    I am asking this because I have to merge the info from this custom module with account module to be accessed in a third system, and I will use the ID from both modules to identify the data. By the way, the merge will be outside of Sugar.
    Regards,

    SugarCRM CE v.5.2.0c
    Windows platform
    MySQL v.5.0.37
    phpMyAdmin - 2.11.2.2
    Apache Server v.2.0

  2. #2
    Angel's Avatar
    Angel is offline Sugar Community Member
    Join Date
    Jul 2005
    Location
    Los Angeles
    Posts
    4,813

    Default Re: Is it possible to have the same ID on diferent modules?

    There was a post on this topic some months back and it was essentially a warning to not do that. Apparently some of the JavaScript code in different areas of Sugar gets confused if the same ID value exists as an ID value in more than one table.
    Regards,

    Angel Magaņa
    Co-Author: Implementing SugarCRM 5.x (Packt Publishing -- Sept. 2010)
    Blog: http://cheleguanaco.blogspot.com.
    Twitter: @cheleguanaco.

    ________
    | Projects: |_____________________________________
    |
    | CandyWrapper (.NET Wrapper for SugarCRM SOAP API). Source now available on GitHub!
    | GoldMine to SugarCRM Express Conversion. Latest: 1.0.1.7 (Nov. 3, 2009)
    | CRM SkyDialer (Skype Integration). Latest: 1.0.2 (Feb. 17, 2010)
    | Round Robin Leads Assignment
    | Phone Number Formatter
    | CaseTwit (Twitter Integration)
    ______________________________________________

  3. #3
    leowolff is offline Sugar Community Member
    Join Date
    Apr 2009
    Posts
    126

    Default Re: Is it possible to have the same ID on diferent modules?

    Thanks Angel for your reply, but I am not worried if Sugar will get confused if the same ID value exists as an ID value in more than one table. Both modules will be exported and merge outside, and a third program will read this single table on another database, so nothing to do with Sugar about reading registers.

    What I am asking is if the ID code generator can create the same ID for diferent register in diferent modules?
    Regards,

    SugarCRM CE v.5.2.0c
    Windows platform
    MySQL v.5.0.37
    phpMyAdmin - 2.11.2.2
    Apache Server v.2.0

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

    Default Re: Is it possible to have the same ID on diferent modules?

    Apart from the concern stated by Angel re Javascript code there should be no reason why two records in two different modules/tables can not have the same ID.

    But the "generator" will not generate them like that, you will have to set the ID of the second module in the save method or a before_save logic hook. (Remember to set new_with_id if you set the id on a new record).

    May I suggest you rather use a derivative of the ID in your second module. A simple solution is to md5 it. Then you have two different ID's (for js and whatever sake) but you can always easily generate the 2nd one from the 1st for your outside linking. You can just add a column to the 1st module that also contain the md5 of the ID and then join on that column.

    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

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

    Default Re: Is it possible to have the same ID on diferent modules?

    Thinking about it a bit more a better solution would be to create a relate field on the second module that contain the id of the first.

    Then you have two records with distinct, sugar generated, ID's but you can link them on the ID on the left and the relate_id on the right.

    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

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: 2009-04-02, 07:42 PM
  2. Modules getting deleted from modules folder?
    By hiko in forum Developer Help
    Replies: 1
    Last Post: 2009-01-16, 08:10 AM
  3. Why new modules not shown in the Role modules list
    By j.lagos in forum Developer Help
    Replies: 1
    Last Post: 2008-09-22, 12:54 PM
  4. modules for 4.0.1d?
    By kickn in forum Downloads
    Replies: 0
    Last Post: 2006-03-17, 07:48 AM

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
  •