Results 1 to 6 of 6

Thread: I'm stuck with logic hook, please help!

  1. #1
    D A G's Avatar
    D A G is offline Senior Member
    Join Date
    Sep 2009
    Posts
    30

    Question I'm stuck with logic hook, please help!

    Good morning everybody! I'm on Version 5.2.0k (Build 5837) and I can't find out a way to do this:

    I need to add a field that when you create a contact you choose between Value 1 or Value 2 .And depending on which one i've selected, i need them to be added automatically in the right target list, because i've got 2 target lists, one for the contacts that are interested in buying houses in the location 1, i.e Value 1 and the other target list for the people that is interested in buying houses in the other location, i.e Value 2.

    I've got no programming skills but with a huge help of this forum I've managed to customize a few things in Sugar, but i'm stuck with this, i've read the logic hook documentation but I don't even understand how to create and fire a logic hook.

    Any help will be really appreciated, thanks in advance for reading my post and spending your time on me.

    Diego

  2. #2
    bickart68 is offline Sugar Community Member
    Join Date
    Apr 2008
    Posts
    111

    Default Re: I'm stuck with logic hook, please help!

    When you say the "right" target list. Are you actually referring to the Campaigns, Target List module?

    to get started with logic hooks.

    you want to create a file called logic_hooks.php in the custom/modules/Contacts directory.
    In that file you'll put.

    $hook_array['before_save'] = Array();
    $hook_array['before_save'][] = Array(1, 'Add to Target List', 'custom/modules/Contacts/TargeListHandler.php','TargetListHandler', 'addTargetList');

    This says that before you are done saving... look for the file custom/modules/Contacts/TargeListHandler.php. In that file look for the class: TargetListHandler
    call the method addTargetList of the TargetListHandler

    Of course you now need to have the file custom/modules/Contacts/TargeListHandler.php

    Inside this file you need to define your class

    class TargeListHandler {

    function addTargetList(& $bean, $event, $arguments) {

    /* do something */
    }
    }

    Where the comment do something exists. Is where you make magic happen. You can check to see what the user selected, what the value was previously. Add the contact to a target list, remove them, etc.

  3. #3
    D A G's Avatar
    D A G is offline Senior Member
    Join Date
    Sep 2009
    Posts
    30

    Default Re: I'm stuck with logic hook, please help!

    When you say the "right" target list. Are you actually referring to the Campaigns, Target List module?
    Yes, you're right!

    I think that i got what you've said but still got some questions.

    Should I add this new field (where i choose between the 2 locations I mentioned before) into the Contacts Module?

    Once I get this done I will create a file called logic_hooks.php in the custom/modules/Contacts directory. Then I create the TargeListHandler.php in the custom/modules/Contacts directory, right?

    And then how can "say": put all the contacts that in the field that i created i.e. the value is Location 1 into the right Target List and put all the contacts that in the field that i created i.e. the value is Location 2 into the other Target List???

    Thanks in advance for your help, I really appreciate.

    Diego

  4. #4
    nileshdave is offline Sugar Community Member
    Join Date
    Nov 2007
    Location
    Gujarat
    Posts
    95

    Smile Re: I'm stuck with logic hook, please help!

    Hello Diego,

    You can try out LogicHook feature in SuarCRM. You can apply procedure to Add record in TargetList "Before Save" or "After Save" event in Logic hook of Contact Module / any module

    To know for regarding Logic Hook Please follow this LINK

    Hope this helps to you.

    Regards,
    Nilesh Dave

  5. #5
    D A G's Avatar
    D A G is offline Senior Member
    Join Date
    Sep 2009
    Posts
    30

    Default Re: I'm stuck with logic hook, please help!

    To know for regarding Logic Hook Please follow this LINK
    The link is missing, anyway thanks for your help, i'm trying to figure it out right now!

    Diego

  6. #6
    nileshdave is offline Sugar Community Member
    Join Date
    Nov 2007
    Location
    Gujarat
    Posts
    95

    Smile Re: I'm stuck with logic hook, please help!

    Hi D A G,

    Apologize for my mistake for empty Lik

    To know for regarding Logic Hook Please follow this LINK

    Hope This help.

    Again sorry,

    Nilesh Dave

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 10
    Last Post: 2010-11-16, 02:41 AM
  2. Help on my first logic hook.
    By amrutha in forum Developer Help
    Replies: 9
    Last Post: 2009-11-24, 01:29 PM
  3. Replies: 3
    Last Post: 2009-08-15, 03:00 AM
  4. Logic HOok
    By mswathi in forum Developer Help
    Replies: 6
    Last Post: 2009-08-02, 11:29 PM
  5. Help with a Logic Hook
    By Iggby in forum Developer Help
    Replies: 6
    Last Post: 2009-01-29, 12:01 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
  •