Results 1 to 4 of 4

Thread: Using Logic Hook to mirror a custom field from a seperate module

  1. #1
    infamousse is offline Senior Member
    Join Date
    Mar 2009
    Posts
    21

    Question Using Logic Hook to mirror a custom field from a seperate module

    I am trying to accomplish the following, hopefully I am on the right track.

    I have added a few custom fields in the 'Accounts' module:

    custom_field1
    custom_field2
    ...and so on

    I have also created a custom module:

    module_field1
    module_field2
    ....and so on

    I would like the data from the 'Accounts' module to copy over and paste into 'Custom Module' fields preferably using a logic hook (I believe after_retrieve is the correct hook to use but i could be wrong).

    e.g. custom_field1 = module_field1 (after retrieve or during the creation of a new Custom Module record via a 1:1 relationship


    I hope this makes sense, I believe its pretty straight forward but I could be wrong. Thanks in advance.
    Last edited by infamousse; 2009-08-17 at 04:19 PM. Reason: sig update

  2. #2
    SugarDev.net is offline Sugar Community Member
    Join Date
    Feb 2008
    Posts
    1,401

    Default Re: Using Logic Hook to mirror a custom field from a seperate module

    There are many ways to do this. A hook is the simplest and upgrade-safe, but Sugar will not 'get' your data so don't expect searching/sorting/auditing etc.

    Some info on relate fields is here: http://www.sugardev.net/content/idea...ields-sugarcrm
    Developers go here
    Businesses go there (Dutch)

    Modules:
    SugarDev.net Developer Tools | Config | Dutch Language Pack
    "Nothing gets fixed unless there is a bug"

  3. #3
    kbrill's Avatar
    kbrill is offline SugarCRM PS Engineer
    Join Date
    Jul 2004
    Location
    St Louis, MO
    Posts
    3,183

    Default Re: Using Logic Hook to mirror a custom field from a seperate module

    Quote Originally Posted by infamousse View Post
    I would like the data from the 'Accounts' module to copy over and paste into 'Custom Module' fields preferably using a logic hook (I believe after_retrieve is the correct hook to use but i could be wrong).
    If you are looking for the data to be copied from accounts to this custom module then a before_save hook would be the one to use I think. However that means that the data will not be passed to the custom module until you actually save the account. If you want this data to be there up front (IE you have accounts with data that you want to be in the custom module) then doing some sort of SQL copy first and then letting the before_save logic hook take care of updates would be the way to go.
    Kenneth Brill - Help Forum Moderator

    I do not respond to 'Private Messages'. Please email me directly instead

    When asking for help, PLEASE give us your Server Information and Version Numbers as asked for on the 'Post New Message' screen as well as any JavaScript errors shown at the bottom of the browser window.
    Help us Help You

  4. #4
    infamousse is offline Senior Member
    Join Date
    Mar 2009
    Posts
    21

    Default Re: Using Logic Hook to mirror a custom field from a seperate module

    So after reading both your threads the ideal thing to do would be gathering data during a before_save (will after_retrieve not do the same). How do I go about implementing this logic? Currently the custom module and the accounts module are carrying a ONE:TO MANY relationship. What type of logic is involved in copying data from:

    accounts_module_custom_field == custom_module_custom_field

    Thanks again for your advice.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 3
    Last Post: 2009-08-15, 03:00 AM
  2. Logic Hook + Passing Date to Custom Date Field
    By chrislynch8 in forum Developer Help
    Replies: 12
    Last Post: 2009-07-22, 03:58 PM
  3. Custom field auto increased by Logic Hook ?
    By dekleinemedia in forum Help
    Replies: 21
    Last Post: 2009-07-06, 09:10 AM
  4. Getting field name of relationship for logic hook
    By jhermiz in forum Developer Help
    Replies: 1
    Last Post: 2008-12-16, 03:44 PM
  5. Logic Hook! how to merge two field contents
    By kinshibuya in forum Help
    Replies: 4
    Last Post: 2008-09-19, 02:36 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
  •