Results 1 to 10 of 10
Like Tree1Likes
  • 1 Post By Angel

Thread: a little question about logic hook

  1. #1
    garciasanchezdaniel's Avatar
    garciasanchezdaniel is offline Sugar Community Member
    Join Date
    Aug 2011
    Location
    Spain
    Posts
    403

    Default a little question about logic hook

    Hello everybody
    I have implemented a logic hook in my module 'holidays', in order to each time one user create a new record, an automatic mail be sent to the admin saying that this user just created a new record
    My logic_hook.php has a code like thishere I have not the code)

    PHP Code:
    $hook_array['before_save'][] = Array(1automaticmail'custom/modules/Holidays/automaticmail.php''automaticmail''lead_before_save_1'); 
    My question is how I can do in order to the mail be sent each time the user creates a new record,I do not want that if the user edits the records a new mail be sent. (because I imagine that if the user edit the record, when he/she push save a new mail is sent to the admin)

    Thanks,
    Daniel

  2. #2
    Angel's Avatar
    Angel is offline Sugar Community Member
    Join Date
    Jul 2005
    Location
    Los Angeles
    Posts
    4,813

    Default Re: a little question about logic hook

    Add an IF statement to the function 'automaticmail' and have it evaluate the following:

    IF (empty($bean->fetched_row['id']))

    If it is empty (true), it is a new record.
    Regards,

    Angel Magaña
    Co-Author: Implementing SugarCRM 5.x (Packt Publishing -- Sept. 2010)
    Blog: http://cheleguanaco.blogspot.com.
    Twitter: @cheleguanaco.

    ________
    | Projects: |_____________________________________
    |
    | CandyWrapper (.NET Wrapper for SugarCRM SOAP API). Source now available on GitHub!
    | GoldMine to SugarCRM Express Conversion. Latest: 1.0.1.7 (Nov. 3, 2009)
    | CRM SkyDialer (Skype Integration). Latest: 1.0.2 (Feb. 17, 2010)
    | Round Robin Leads Assignment
    | Phone Number Formatter
    | CaseTwit (Twitter Integration)
    ______________________________________________

  3. #3
    garciasanchezdaniel's Avatar
    garciasanchezdaniel is offline Sugar Community Member
    Join Date
    Aug 2011
    Location
    Spain
    Posts
    403

    Default Re: a little question about logic hook

    Gracias Ángel es lo que necesitaba
    Saludos!

  4. #4
    garciasanchezdaniel's Avatar
    garciasanchezdaniel is offline Sugar Community Member
    Join Date
    Aug 2011
    Location
    Spain
    Posts
    403

    Default Re: a little question about logic hook

    I have one question more ... how could be the code to implement in order to send an automatic mail to a user that just assigned one record to him? that is, a first user assigns a record to a second user, so I want send an automatic mail to the second user in order to alert him
    could be something like this?

    PHP Code:
    global $current_user;
    if (
    $bean->assigned_user_name != $current_user->name){
          
    //code in order to send mail to $bean->assigned_user_name   

    thanks
    Last edited by garciasanchezdaniel; 2011-09-21 at 07:31 AM.

  5. #5
    Angel's Avatar
    Angel is offline Sugar Community Member
    Join Date
    Jul 2005
    Location
    Los Angeles
    Posts
    4,813

    Default Re: a little question about logic hook

    No entiendo muy bien exactamente lo que desea. Si gusta, expliquelo en Espanhol y con gusto le ayudo.
    Regards,

    Angel Magaña
    Co-Author: Implementing SugarCRM 5.x (Packt Publishing -- Sept. 2010)
    Blog: http://cheleguanaco.blogspot.com.
    Twitter: @cheleguanaco.

    ________
    | Projects: |_____________________________________
    |
    | CandyWrapper (.NET Wrapper for SugarCRM SOAP API). Source now available on GitHub!
    | GoldMine to SugarCRM Express Conversion. Latest: 1.0.1.7 (Nov. 3, 2009)
    | CRM SkyDialer (Skype Integration). Latest: 1.0.2 (Feb. 17, 2010)
    | Round Robin Leads Assignment
    | Phone Number Formatter
    | CaseTwit (Twitter Integration)
    ______________________________________________

  6. #6
    garciasanchezdaniel's Avatar
    garciasanchezdaniel is offline Sugar Community Member
    Join Date
    Aug 2011
    Location
    Spain
    Posts
    403

    Default Re: a little question about logic hook

    Gracias! Esto es lo que quiero:
    Un usuario crea un nuevo registro, y lo asigna a un segundo usuario distinto, le llegue un mail automático al segundo usuario.

  7. #7
    garciasanchezdaniel's Avatar
    garciasanchezdaniel is offline Sugar Community Member
    Join Date
    Aug 2011
    Location
    Spain
    Posts
    403

    Default Re: a little question about logic hook

    ¿Podría ayudarme con este otro hilo que me urge más? http://www.sugarcrm.com/forums/f3/co...-module-74994/

    Gracias Ángel

  8. #8
    Angel's Avatar
    Angel is offline Sugar Community Member
    Join Date
    Jul 2005
    Location
    Los Angeles
    Posts
    4,813

    Default Re: a little question about logic hook

    Quote Originally Posted by garciasanchezdaniel View Post
    Gracias! Esto es lo que quiero:
    Un usuario crea un nuevo registro, y lo asigna a un segundo usuario distinto, le llegue un mail automático al segundo usuario.
    Seria algo como lo que explico en este post en mi blog:

    Angel's Blog: SugarCRM Customization: Custom Workflow E-mails

    Igual, el sistema lo hace por defecto con las notificaciones. Pero la desventaja es que no se le ofrece mucho control sobre el contenido.
    Regards,

    Angel Magaña
    Co-Author: Implementing SugarCRM 5.x (Packt Publishing -- Sept. 2010)
    Blog: http://cheleguanaco.blogspot.com.
    Twitter: @cheleguanaco.

    ________
    | Projects: |_____________________________________
    |
    | CandyWrapper (.NET Wrapper for SugarCRM SOAP API). Source now available on GitHub!
    | GoldMine to SugarCRM Express Conversion. Latest: 1.0.1.7 (Nov. 3, 2009)
    | CRM SkyDialer (Skype Integration). Latest: 1.0.2 (Feb. 17, 2010)
    | Round Robin Leads Assignment
    | Phone Number Formatter
    | CaseTwit (Twitter Integration)
    ______________________________________________

  9. #9
    garciasanchezdaniel's Avatar
    garciasanchezdaniel is offline Sugar Community Member
    Join Date
    Aug 2011
    Location
    Spain
    Posts
    403

    Default Re: a little question about logic hook

    Quote Originally Posted by Angel View Post
    Seria algo como lo que explico en este post en mi blog:

    Angel's Blog: SugarCRM Customization: Custom Workflow E-mails

    Igual, el sistema lo hace por defecto con las notificaciones. Pero la desventaja es que no se le ofrece mucho control sobre el contenido.
    Muchas gracias Ángel.
    Y una cosa más, ¿sabes por qué falla a veces loadBean()? porque lo implementé para recoger los datos de un módulo y copiarlos en otro módulo, y hay veces que no carga sugarcrm...como explico en el hilo http://www.sugarcrm.com/forums/f3/co...-module-74994/

  10. #10
    Angel's Avatar
    Angel is offline Sugar Community Member
    Join Date
    Jul 2005
    Location
    Los Angeles
    Posts
    4,813

    Default Re: a little question about logic hook

    Ya le comento, lo acabo de revisar.
    Regards,

    Angel Magaña
    Co-Author: Implementing SugarCRM 5.x (Packt Publishing -- Sept. 2010)
    Blog: http://cheleguanaco.blogspot.com.
    Twitter: @cheleguanaco.

    ________
    | Projects: |_____________________________________
    |
    | CandyWrapper (.NET Wrapper for SugarCRM SOAP API). Source now available on GitHub!
    | GoldMine to SugarCRM Express Conversion. Latest: 1.0.1.7 (Nov. 3, 2009)
    | CRM SkyDialer (Skype Integration). Latest: 1.0.2 (Feb. 17, 2010)
    | Round Robin Leads Assignment
    | Phone Number Formatter
    | CaseTwit (Twitter Integration)
    ______________________________________________

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. after_save logic hook question
    By Keenn in forum Developer Help
    Replies: 2
    Last Post: 2011-03-24, 08:42 AM
  2. Logic Hook question
    By marketadvantage in forum Developer Help
    Replies: 3
    Last Post: 2009-01-23, 01:44 PM
  3. Logic Hook Question for Login
    By swhitlow in forum Developer Help
    Replies: 5
    Last Post: 2008-11-18, 02:50 PM
  4. Logic Hook Question
    By dalty52 in forum Developer Help
    Replies: 3
    Last Post: 2007-04-30, 02:07 AM
  5. Logic Hook Question
    By swhitlow in forum Developer Help
    Replies: 1
    Last Post: 2006-06-04, 04:49 AM

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
  •