Results 1 to 2 of 2

Thread: Need help implementing a logic hook

  1. #1
    bstonehill is offline Sugar Community Member
    Join Date
    Nov 2006
    Location
    Atlanta, GA
    Posts
    98

    Default Need help implementing a logic hook

    I need to execute some php code when a relationship field is changed. I found a list of available logic hooks and based on that it appears that what I may have to do is execute my code on every record save using the after_save hook and then have my php code determine if my criteria is met (relationship field changed). I have two questions, first am I correct in my assumption or is there a way to only fire the logic hook on that particular field, and will the after_save hook fire with mass update?

    Also any tips/hints/article links on getting started with logic hooks would be greatly appreciated since this will be my first attempt at using them.

    Thanks
    Sugar Version 5.1.0a
    PHP 5.2.5
    MySQL 5.0.37

  2. #2
    jleaman's Avatar
    jleaman is offline Senior Member
    Join Date
    May 2009
    Location
    Boston
    Posts
    58

    Default Re: Need help implementing a logic hook

    If you have an after_save logic hook it will be kicked off after save. It will not fire only-if one field is changed. But in your php code you can have an action only happen if.

    To check whether you have a change to the field you may need two logic hooks -- one to get the relationship before the save and one to check if it is different after the save.

    Wiki page:
    http://www.sugarcrm.com/wiki/index.p...le=Logic_Hooks

    Search on the forums as well.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Logic Hook
    By Aespejo in forum Español
    Replies: 11
    Last Post: 2012-03-05, 11:27 AM
  2. Logic hook, only run if...
    By hensor in forum Developer Help
    Replies: 1
    Last Post: 2009-10-09, 10:53 AM
  3. Which logic hook, where?
    By dantrainor in forum Developer Help
    Replies: 0
    Last Post: 2009-09-04, 07:17 AM
  4. Replies: 3
    Last Post: 2009-08-15, 03:00 AM
  5. Can I do this with a logic hook?
    By daerid in forum Developer Help
    Replies: 2
    Last Post: 2008-04-23, 05:49 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
  •