Results 1 to 9 of 9

Thread: How to create newsletter subscriber web form?

  1. #1
    whallify is offline Member
    Join Date
    Jan 2009
    Posts
    15

    Default How to create newsletter subscriber web form?

    I had posted this as a reply on a different thread, but maybe that hid it well enough to prevent an answer.

    I'm using SugarCRM CE 5.2.0 (Build 5380) and have done several email campaigns with success, and I've used the Web to Lead form many times to create useful landing pages within our normal website framework to create Leads in Sugar.

    I'm now interested in starting the newsletter functionality in Sugar. However, I don't see how to create a simple "Subscribe to our newsletter" widget on our webpage so that the end result is a creation of a target on the Newsletter Subscription list. Instead, it just creates leads.

    Is there a simple mostly-out-of-the-box answer to this?

    What I tried:
    1. Created newsletter campaign
    2. It created the three target lists (subscription, test, and supression)
    3. I did "generate lead form" with last name, email
    4. Ran a sample record through the lead form
    5. Sugar generated a lead that was referencing the newsletter campaign
    6. The newsletter subscription target list has no additional members, and clicking on the subscription list and looking at "leads" (on Marketing tab) on the newsletter campaign shows no leads added.

  2. #2
    weemillent is offline Member
    Join Date
    May 2007
    Posts
    6

    Default Re: How to create newsletter subscriber web form?

    I'm actually suffering through the same issue. I've created the subscriber list, created the web to lead form, but the leads, while related to the campaign, are not added directly to the target list.

    Is there any way to tend to this?

  3. #3
    kuske's Avatar
    kuske is offline Sugar Community Member
    Join Date
    Oct 2007
    Location
    Germany
    Posts
    2,597

    Default Re: How to create newsletter subscriber web form?

    The WebToLead form does not add any lead to any targetlist.

    The campaign, you give to the WebToLead form is only stored in the lead record.

    If you want o add all leads generated by such a webToLead form you must add them manually to a target list.

    Or you write a logic_hook before_save of a lead whichs recognizes the campaign in the lead data and creates an entry in the whished target list.
    Harald Kuske
    Pre-Sales Engineer Central Europe

    SUGARCRM Deutschland GmbH
    Erika-Mann-Str. 53, 80636 Munich, Germany
    Email: hkuske@sugarcrm.com
    Home: http://www.sugarcrm.com


  4. #4
    weemillent is offline Member
    Join Date
    May 2007
    Posts
    6

    Default Re: How to create newsletter subscriber web form?

    Kuske, Thanks so much for all your help. I've finally gotten everything working with logic hooks.

    These are my files, in case it'll help anyone. It seems to work pretty well!
    PHP Code:
    <?php
    // custom/modules/Leads/logic_hooks.php

    // Do not store anything in this file that is not part of the array or the hook version.  This file will
    // be automatically rebuilt in the future.
    $hook_version 1;
    $hook_array = Array();
    // position, file, function
    $hook_array['before_save'] = Array();
    $hook_array['before_save'][] = Array(1'UpdateTargetList''custom/modules/Leads/UpdateTargetListAutomatically.php''UpdateTargetListAutomatically''UpdateTargetList');
    ?>
    PHP Code:
    <?PHP
    class UpdateTargetListAutomatically
    {
        function 
    UpdateTargetList(&$bean$event$arguments="")
        {
            
    $listBean = new ProspectList();
            
    $listBean->retrieve('3ab3e58d-b726-33d0-393c-4a90fec10013');
            
    $listBean->load_relationship('leads');
            
    $listBean->leads->add($bean->id); // '8c81cd29-e2b7-661d-e46a-4b999a1eb9f8'
        
    }
    }
    ?>

  5. #5
    hburg is offline Junior Member
    Join Date
    Mar 2010
    Posts
    1

    Default Re: How to create newsletter subscriber web form?

    I'm glad to see that you found out the solution... but I'm new in Sugar and not much skilled in programming and after trying diferent options I haven't been able to implement the logic hook

    So, before trying more possibilities, can you tell me how did you implement this hook?

    Thanks a lot in advance!!!
    Last edited by hburg; 2010-03-22 at 12:23 PM.

  6. #6
    sebek is offline Sugar Community Member
    Join Date
    Mar 2008
    Posts
    96

    Default Re: How to create newsletter subscriber web form?

    This hook is used in every webtolead form or can it be used just for chosen one?

    I use Typo3 form to add leads to Sugar...but would like to have one form to create leads...and one for creating target lists for newsletter campaign.

  7. #7
    weemillent is offline Member
    Join Date
    May 2007
    Posts
    6

    Default Re: How to create newsletter subscriber web form?

    Hey guys, I'm still very new to this too. if you notice in the comments section, there is

    // custom/modules/Leads/logic_hooks.php

    that's where you'd put the two files, the first being logic_hooks.php and the second one being UpdateTargetListAutomatically.php

    because we're creating a hook based on leads. so you're not actually moving leads to the target list, you're linking the leads to the campaign.

    ideally, you just replace the prospect_id (which you'll find in the url of the campaign target) of the file UpdateTargetListAutomatically.php

    I'm probably being a bit convoluted. Hope this helps!

  8. #8
    arosenberg is offline Junior Member
    Join Date
    May 2011
    Posts
    3

    Default Re: How to create newsletter subscriber web form?

    Could you please explain more clearly what IDs are replaced in the php code below.

    What do I replaced the retrieve ID with?
    What do I replace the leads-->add IF with?



    <?PHP
    class UpdateTargetListAutomatically
    {
    function UpdateTargetList(&$bean, $event, $arguments="")
    {
    $listBean = new ProspectList();
    $listBean->retrieve('3ab3e58d-b726-33d0-393c-4a90fec10013');
    $listBean->load_relationship('leads');
    $listBean->leads->add($bean->id); // '8c81cd29-e2b7-661d-e46a-4b999a1eb9f8'
    }
    }?>

  9. #9
    ollelinux is offline Junior Member
    Join Date
    Oct 2011
    Posts
    1

    Default Re: How to create newsletter subscriber web form?

    kuske, weemillent thank you guys.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Create Newsletter Module in sugarCRM?
    By testprojectsnow in forum Developer Help
    Replies: 2
    Last Post: 2011-02-03, 12:21 PM
  2. Capture emails with a form -newsletter
    By landed in forum Marketing/Campaign Management
    Replies: 1
    Last Post: 2010-03-08, 01:31 AM
  3. Replies: 4
    Last Post: 2009-02-18, 10:57 AM
  4. Replies: 3
    Last Post: 2008-08-06, 12:31 AM
  5. create form
    By nazrin in forum Help
    Replies: 0
    Last Post: 2006-10-19, 02:02 AM

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
  •