Results 1 to 9 of 9

Thread: Make my own web form? Not lead.

  1. #1
    eikum is offline Member
    Join Date
    Jan 2009
    Posts
    11

    Default Make my own web form? Not lead.

    Hello.
    I have just created my own module with SugerCRM. Its almost like the Lead module.
    But I want to create a web form like I can do with Lead. A person can visit my website and then register, when the user click on the "apply" button. The information will be sent to my own SugarCRM module.

    How can I do this? any tips?

    Regards,

  2. #2
    letrium is offline Sugar Community Member
    Join Date
    Dec 2008
    Posts
    614

  3. #3
    eikum is offline Member
    Join Date
    Jan 2009
    Posts
    11

    Default Re: Make my own web form? Not lead.

    Any link or tutorial for this app?

  4. #4
    dlorenzetti's Avatar
    dlorenzetti is offline Sugar Community Member
    Join Date
    Jan 2008
    Location
    São Paulo, Brasil
    Posts
    189

    Default Re: Make my own web form? Not lead.

    Sugar have a file called leadCapture.php. this file call the modules/Leads/Capture.php. You can write a file like that to insert data in your module.
    Diego Lorenzetti
    Lampada Global Services - Open Source Solutions
    Phone: +55 11 3237-3110
    Email: equipe@lampadaglobal.com
    Site: www.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.

  5. #5
    eikum is offline Member
    Join Date
    Jan 2009
    Posts
    11

    Default Re: Make my own web form? Not lead.

    Like you see under here, the value its in the code. But I want to create a .html page with textboxes. When one user type in a name, the information will be sent to this script under here.. Is this possible? Like when I type "Mac" in a test.html the name "Mac" will be sent to array('name'=>'first_name','value'=>'Mac'),

    Code:
    <?php
    // add nusoap library
    require_once('lib/nusoap.php');
    
    // create a soap client
    $client = new nusoap_client('http://nettside.org/sugar/soap.php?wsdl','wsdl','','','','');
    
    // Login
    $user_auth = array(
    'user_auth' => array(
    'user_name' => 'admin',
    'password' => md5('adminpassord'),
    'version' => '0.1'),
    'application_name' => 'SugarCrm'
    );
    
    $result = $client->call('login',$user_auth);
    
    // output the session id
    echo '<h2>Session Id:</h2>';
    print($result['id']);
    
    // Now Prepare a Contact
    $set_entry_params = array(
    'session' => $result['id'],
    'module_name' => 'Contacts',
    'name_value_list'=>array(
    array('name'=>'first_name','value'=>'Ola'),
    array('name'=>'last_name','value'=>'Norman'),
    array('name'=>'email1','value'=>'konge@norge.com'),
    array('name'=>'lead_source','value'=>'http://www.kongen.com'),
    array('name'=>'phone_work', 'value'=>'22445566'),
    array('name'=>'account_name','value'=>'Okei')
    )
    );
    
    // Now Add the Contact
    $result2 = $client->call('set_entry',$set_entry_params);
    
    // Show the result
    echo '<h2>Add Dump:</h2>';
    print_r($result2);
    ?>

  6. #6
    ssmeredith is offline Sugar Community Member
    Join Date
    Mar 2007
    Posts
    17

    Default Re: Make my own web form? Not lead.

    Hey D!

    I'm going to piggy back on this post as it's a few months old and not resolved....

    My question is similar but I want to have my lead form dump into the contacts module instead of a custom module. Should be one line difference right? Any help or direction would be greatly appreciated.

    Save me from a handful of more grey hairs

    Thank you!
    M

  7. #7
    livinonthedge is offline Member
    Join Date
    Oct 2008
    Posts
    7

    Default Re: Make my own web form? Not lead.

    We're looking at doing the same kind of stuff. Any help out there?

  8. #8
    eggsurplus's Avatar
    eggsurplus is offline Sugar Community Member
    Join Date
    Dec 2005
    Location
    Minnesota
    Posts
    2,343

    Default Re: Make my own web form? Not lead.

    I'd recommend just altering the leadCapture.php form. Make a copy of it and set the first line of the file as a valid entry point (example in some other Sugar code for how to do that). Then alter to push to contacts. It should take a couple of hours at most. If you're familiar with Sugar it may take about a half hour.

    I'm too nice. Here's a sample contactCapture.php form (use like leadCapture but put in the root Sugar folder):
    PHP Code:
    <?php
    if(!defined('sugarEntry'))define('sugarEntry'true);

    require_once(
    'include/entryPoint.php');
    require_once(
    'include/utils.php');
    require_once(
    'modules/Contacts/ContactFormBase.php');

    global 
    $app_strings$app_list_strings;

    $mod_strings return_module_language($sugar_config['default_language'], 'Contacts');

    $app_list_strings['record_type_module'] = array('Contact'=>'Contacts''Account'=>'Accounts''Opportunity'=>'Opportunities''Case'=>'Cases''Note'=>'Notes''Call'=>'Calls''Email'=>'Emails''Meeting'=>'Meetings''Task'=>'Tasks''Contact'=>'Contacts','Bug'=>'Bugs',);

    $users = array(
        
    'form_user' => array('name'=>'SUGAR_USER_HERE_USEGENERICUSER''pass'=>'USER_HASH_HERE'),
    );

    if (!empty(
    $_POST['user']) && !empty($users[$_POST['user']])) {
        require_once(
    'modules/Users/User.php');
        
    $current_user = new User();
        
    $current_user->user_name $users[$_POST['user']]['name'];

        if(
    $current_user->authenticate_user($users[$_POST['user']]['pass'])){
            
    $userid $current_user->retrieve_user_id($users[$_REQUEST['user']]['name']);
            
    $current_user->retrieve($userid);
            
    $contactForm = new ContactFormBase();
            
    $prefix '';
            if(!empty(
    $_POST['prefix'])){
                
    $prefix =     $_POST['prefix'];
            }


            
    $_POST['record'] ='';

            if( isset(
    $_POST['_splitName']) ) {
                
    $name explode(' ',$_POST['name']);
                if(
    sizeof($name) == 1) {
                    
    $_POST['first_name'] = '';  $_POST['last_name'] = $name[0];
                }
                else {
                    
    $_POST['first_name'] = $name[0];  $_POST['last_name'] = $name[1];
                }
            }

            
    $return_val $contactForm->handleSave($prefixfalsetrue);

            if(isset(
    $_POST['redirect']) && !empty($_POST['redirect'])){

                
    //header("Location: ".$_POST['redirect']);
                
    echo '<html><head><title>SugarCRM</title></head><body>';
                echo 
    '<form name="redirect" action="' .$_POST['redirect']. '" method="POST">';

                foreach(
    $_POST as $param => $value) {

                    if(
    $param != 'redirect' || $param != 'submit') {
                        echo 
    '<input type="hidden" name="'.$param.'" value="'.$value.'">';
                    }

                }

                if( (
    $return_val == '') || ($return_val  == 0) || ($return_val 0) ) {
                    echo 
    '<input type="hidden" name="error" value="1">';
                }
                echo 
    '</form><script language="javascript" type="text/javascript">document.redirect.submit();</script>';
                echo 
    '</body></html>';
            }
            else{
                echo 
    "Thank You For Your Submission.";
            }
            
    sugar_cleanup();
            
    // die to keep code from running into redirect case below
            
    die();
        }
    }

    echo 
    "We're sorry, the server is currently unavailable, please try again later.";
    if (!empty(
    $_POST['redirect'])) {
        echo 
    '<html><head><title>SugarCRM</title></head><body>';
        echo 
    '<form name="redirect" action="' .$_POST['redirect']. '" method="POST">';
        echo 
    '</form><script language="javascript" type="text/javascript">document.redirect.submit();</script>';
        echo 
    '</body></html>';
    }
    ?>

  9. #9
    chiefnt is offline Member
    Join Date
    Jun 2008
    Posts
    9

    Default Re: Make my own web form? Not lead.

    Can someone help me understand this solution? Here's my take on it....and please forgive me as I'm a non-technical newbie and probably shouldn't even be posting here:

    I’ve created a Capture.php file using the above code and placed it in the modules/Contact directory. This didn’t work, not surprisingly.

    I need to understand:
    1) Where exactly does this code go?
    2) I’m assuming what Eggsurplus has graciously provided is the bulk of the solution and any other changes are minor ( I hope). Can someone outline what other files need to be altered to get this to work.
    3) Do I need to change the script on the web form?
    4) If this ends up working, would I still be able to create web-to-lead forms with the new web-to-contact functionality?

    Thanks!

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. How to make create button to open full form
    By sswamy in forum Developer Help
    Replies: 1
    Last Post: 2008-12-07, 09:15 AM
  2. Make email-address required on Lead and Contact
    By redpillsweden in forum Developer Help
    Replies: 2
    Last Post: 2008-11-19, 09:32 PM
  3. How to submit 'Web Form' as lead source from web form
    By pkelly08 in forum Developer Tutorials
    Replies: 0
    Last Post: 2008-10-07, 01:40 AM
  4. Replies: 0
    Last Post: 2008-10-07, 12:50 AM
  5. trying to make the lead page display a new field
    By keak in forum Developer Help
    Replies: 0
    Last Post: 2007-02-17, 08:32 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
  •