Results 1 to 2 of 2

Thread: Logic Hook Question

  1. #1
    swhitlow's Avatar
    swhitlow is offline Sugar Community Member
    Join Date
    Jun 2005
    Location
    Indianapolis, IN.
    Posts
    204

    Exclamation Logic Hook Question

    I am calling a save function from a logic hook I have called from a Meetings object. My question is - won't it recursively call my logic hook over again once I call the save function? Here is an example of what I am doing:

    1. In the meetings I have a logic hook for the "before_save"
    2. In my logic hook I am creating a new instance of the meeting object. WIth this object I am saving a new record.
    3. Obviously, once this saves it will call my logic hook again and go through the same cycle.

    How can I avoid this? I need to use the Meetings object or resort to just doing a manual sql insert which would be the sloppy way of doing it.

    Any suggestions?
    Scott Whitlow
    Lead Software Engineer/SugarCRM Developer
    swhitlow at gmail.com
    Indianapolis, IN. USA

  2. #2
    julian's Avatar
    julian is offline Sugar Team Member
    Join Date
    Sep 2004
    Posts
    1,639

    Default Re: Logic Hook Question

    Hello Scott,

    I haven't tried this before (my logic hooks have always triggered other events, rather than editing the object), so I'm not sure any recursive logic will occur.

    If it does, I suggest adding a flag to the Meetings class-- $first_save, or $call_logic_hooks, etc. You can modify this flag in your logic hook and disable it from running again.
    Julian Ostrow
    Systems and Applications Engineer
    SugarCRM Inc.

Thread Information

Users Browsing this Thread

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

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
  •