Results 1 to 7 of 7

Thread: Fire hook when subpanel has been modified?

  1. #1
    rusdvl is offline Senior Member
    Join Date
    Feb 2009
    Posts
    48

    Default Fire hook when subpanel has been modified?

    SugarCRM 5.5.0

    Hi,

    Is there a way to fire a hook when a subpanel has been modified?

    I need to perform an action whenever accounts or leads have been added to the target list subpanels.

    Cheers

  2. #2
    andopes's Avatar
    andopes is offline A Sugar Hero | Help Forum Moderator
    Join Date
    Jul 2006
    Location
    São Paulo - Brazil
    Posts
    8,335

    Default Re: Fire hook when subpanel has been modified?

    It can be accomplished through logic_hook process_record.

    Cheers
    André Lopes
    DevToolKit / Project of the Month - June 2009
    Lampada Global Services- Open Source Solutions
    Avenida Ipiranga, 318
    Bloco B - CJ 1602
    São Paulo, SP 01046-010
    Brazil
    Office: +55 11 3237-3110
    Mobile: +55 11 7636-5859
    e-mail: andre@lampadaglobal.com

    Lampada Global delivers offshore software development and support services to customers around the world.
    Lampada is proud to be a SugarCRM Gold Partner, revolutionizing Customer Relationship Management.

    I DO NOT answer questions through PM and Email. If you need some help post your question into SugarForum.

  3. #3
    rusdvl is offline Senior Member
    Join Date
    Feb 2009
    Posts
    48

    Default Re: Fire hook when subpanel has been modified?

    Is the hook file suppose to sit somewhere else? I have it currently sitting in custom\modules\ProspectLists but it doesn't work there. When the hook is after_save, then it works fine. But I need it to fire when the subpanels have been modified.

    Thanks for the help

  4. #4
    andopes's Avatar
    andopes is offline A Sugar Hero | Help Forum Moderator
    Join Date
    Jul 2006
    Location
    São Paulo - Brazil
    Posts
    8,335

    Default Re: Fire hook when subpanel has been modified?

    Exactly what do you want to do?
    If you want to fire a custom function when a record on subpanel is saved you can use the before_save logic_hook, but you should need to check if this record is been saved from a subpanel or from any other view.
    Inside the logic_hook function add the following code:

    PHP Code:
    echo "<pre>";
    print_r($_REQUEST);
    echo 
    "</pre>";
    die(); 
    Then try to edit or create a record from subpanel and check the request attributes;
    The try to create a record from its own module and check the request.
    Try to identify which attributes are available only on subpanel event.

    Cheers
    André Lopes
    DevToolKit / Project of the Month - June 2009
    Lampada Global Services- Open Source Solutions
    Avenida Ipiranga, 318
    Bloco B - CJ 1602
    São Paulo, SP 01046-010
    Brazil
    Office: +55 11 3237-3110
    Mobile: +55 11 7636-5859
    e-mail: andre@lampadaglobal.com

    Lampada Global delivers offshore software development and support services to customers around the world.
    Lampada is proud to be a SugarCRM Gold Partner, revolutionizing Customer Relationship Management.

    I DO NOT answer questions through PM and Email. If you need some help post your question into SugarForum.

  5. #5
    rusdvl is offline Senior Member
    Join Date
    Feb 2009
    Posts
    48

    Default Re: Fire hook when subpanel has been modified?

    Basically what I am trying to achieve is to make sugar fire an action when accounts or leads are added to the target list. When you create a target list you can add leads, contacts and accounts in the subpanel of your new target list.

    I need sugar to do an action when those accounts are added to the target list, not when the target list is first created or edited or whatever. Only when accounts are added to a target lists subpanel.

    So I've created a target list, named it 'Test'. I then go into that target list and in the subpanels I click on the select button under the 'Accounts' subpanel and select the records that I want to add to that target list. Once it has added the accounts, I need to fill out a field for each of those accounts in each account, or email them; doesn't really matter what the action is. I just need to know how to fire the hook. after_save is only if I edit and save the target list so that doesn't work.

    Hope you can help. Thanks!

  6. #6
    andopes's Avatar
    andopes is offline A Sugar Hero | Help Forum Moderator
    Join Date
    Jul 2006
    Location
    São Paulo - Brazil
    Posts
    8,335

    Default Re: Fire hook when subpanel has been modified?

    Unfortunately after_save or before_save logic_hooks are not triggered by "Creating a Relationship between 2 existing records".
    Unfortunately there is no logic_hook to trigger such event, so you should to either:
    • Override the method "save_relationship_changes" on every modules displayed on subpanel or;
    • Create pseudo modules, which extends the default ones, in order to be able to implement this method on pseudo module classes. The appropriate updates should be applied on extended layoutefs of Prospect Lists.


    Cheers
    André Lopes
    DevToolKit / Project of the Month - June 2009
    Lampada Global Services- Open Source Solutions
    Avenida Ipiranga, 318
    Bloco B - CJ 1602
    São Paulo, SP 01046-010
    Brazil
    Office: +55 11 3237-3110
    Mobile: +55 11 7636-5859
    e-mail: andre@lampadaglobal.com

    Lampada Global delivers offshore software development and support services to customers around the world.
    Lampada is proud to be a SugarCRM Gold Partner, revolutionizing Customer Relationship Management.

    I DO NOT answer questions through PM and Email. If you need some help post your question into SugarForum.

  7. #7
    rusdvl is offline Senior Member
    Join Date
    Feb 2009
    Posts
    48

    Default Re: Fire hook when subpanel has been modified?

    It's a shame there's no hook for that. But thanks for the help. Will try solving it using your suggestions and will post outcome.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Case history subpanel hook
    By msetim in forum Developer Help
    Replies: 1
    Last Post: 2009-05-28, 03:53 AM
  2. fire logic hook after duplicate value has been resolved
    By ServerStorm in forum Developer Help
    Replies: 0
    Last Post: 2009-02-04, 05:14 PM
  3. Replies: 3
    Last Post: 2008-07-30, 12:54 PM
  4. Replies: 0
    Last Post: 2008-07-17, 11:57 PM
  5. Ken Brill's on fire!!!
    By andydreisch in forum Musings, Mullings, and Mutterings
    Replies: 10
    Last Post: 2007-01-17, 06:51 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
  •