Results 1 to 4 of 4

Thread: Join to custom module behaves different from standard modules

  1. #1
    blanik is offline Junior Member
    Join Date
    May 2009
    Posts
    6

    Default Join to custom module behaves different from standard modules

    Hi,

    Sugar CE 5.2

    I added a custom module mrm_period, then added a one-to-many lrelationship from accounts to mrm_period in studio.

    Everything works OK in the application however when I looked at the underlying llinking tables to do activity reporting I found differences in the way that links between standard modules accounts->contacts and custom modules accounts->mrm_period both of which are one-to-many links..

    Created account A linked to mrm_period P

    This generated the link in accounts_mrm_period_c

    uuid1 - modified 08:00 - deleted=0 - ida=A, idn=P

    everything as expected

    I then edited P and changed a telephone number
    accounts_mrm_period_c then contained

    uuid2 - modified 08:10 - deleted=0 - ida=A, idb=P
    uuid1 - modified 08:10 - deleted=1 - ida=A, idb=P

    A further change to the telephone number produced

    uuid3 - modified 08:20 - deleted=0, ida=A, idb=P
    uuid2 - modified 08:20 - deleted=1, ida=A, idb=P
    uuid1 - modified 08:20 - deleted=1, ida=A, idb=P

    So everytime I edit any field in mrm_period all the links are being logically deleted and a new link created. Obviously this has performance issues.

    I tried the same test on accounts->contacts and the behaviour was as expected - the link is set up once and not affected by an edit of a non-linked field.

    Is this a problem with the way that studio has set up the custom one-to-many join, or the edit screen for the custom module?

    Is anyone else having the same problem?

    Thanks

  2. #2
    amao is offline Member
    Join Date
    Jan 2009
    Posts
    12

    Default Re: Join to custom module behaves different from standard modules

    That is working principle of SugarCRM. It seems like, they never really delete any record in database.
    For one reason, in this situation, you are able to review the change history of any record.
    Of course ths cost is performance.

    I think it is not necessary for most of Model application.
    In principle, you can rewrite the save function for the new Model, to avoid this.

  3. #3
    blanik is offline Junior Member
    Join Date
    May 2009
    Posts
    6

    Default Re: Join to custom module behaves different from standard modules

    Thanks Amao,

    I have no problem with the locigal deletes that SugarCRM does normally, but for the custom module it looks like it is logically deleting and inserting records into the link table when no changes are made to the link.

  4. #4
    amao is offline Member
    Join Date
    Jan 2009
    Posts
    12

    Default Re: Join to custom module behaves different from standard modules

    It is possible, that you create a related field in mrm_period model for EditView page.
    This related field is used to indicate a related 'account' object, and this information is saved in link table.
    In this case, if you change any input value of this object, all of information including this related field is submitted.

    And Sugar will not check if the value of related field is changed, it will accepted the submitted value of this related field, 'delete' the old link and add new record in link table, thought the change is about for example description field. That is why, no change for link, but new record.

    Not 100% sure!
    For detail you should check the save function.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Basic/Adv Search join/left join seaches
    By kenneth.thorman in forum Developer Help
    Replies: 25
    Last Post: 2011-03-16, 12:44 PM
  2. Using relationships with standard modules
    By kdiederich in forum General Discussion
    Replies: 2
    Last Post: 2008-10-03, 04:01 AM
  3. creating relation between standard modules
    By waverider in forum Developer Help
    Replies: 2
    Last Post: 2008-04-03, 03:25 PM
  4. Role and custom (non-standard) module?
    By dogfuel in forum Developer Help
    Replies: 0
    Last Post: 2007-11-15, 04:56 AM
  5. Replies: 14
    Last Post: 2007-01-19, 09:35 PM

Tags for this Thread

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
  •