Results 1 to 5 of 5

Thread: Save data problem in email_addr_bean_rel

  1. #1
    arpita rana is offline Sugar Community Member
    Join Date
    Sep 2011
    Posts
    13

    Thumbs up Save data problem in email_addr_bean_rel

    I want to insert record in email_addr_bean_rel table and i used REST API through cURL.

    Still i traced out code i knew, For saving record in this table need to pass parameter but how to pass parameter. that is my question:-
    i passed out in following way with set_entry method.

    $saNameValueList = array(array('name'=>'email_address', value'=>'test@gmail.com'),
    array('name'=>'primary_address', 'value'=>1),
    array('name'=>'reply_to_address', 'value'=>0),
    array('name'=>'invalid_email', 'value'=>0),
    array('name'=>'opt_out', 'value'=>1),
    );
    $set_entry_params_acc = array('session' => $session_id, 'module_name'=>'EmailAddresses',
    'name_value_list'=>$saNameValueList);
    $asParams = array('method' => 'set_entry','input_type' => 'JSON','response_type' => 'JSON',
    'rest_data' => json_encode($set_entry_params_acc));

    So,Please correct my code wherever i wrong.
    I need your help ASAP.
    Thanks in advance.

  2. #2
    sts's Avatar
    sts
    sts is offline Sugar Community Member
    Join Date
    Aug 2010
    Posts
    978

    Default Re: Save data problem in email_addr_bean_rel

    Here is an example for creating a lead using the 'set_entry' method. This works with my 6.2 installation. I removed some lines (I had several more 'name_value_list' entries) to make it shorter. I hope this helps you:

    PHP Code:
        // create a new leads record and grab the leads ID
        
    $param_entry_list=array(
            
    'session'=>$session_id,
            
    'module_name'=>'Leads',
            
    'name_value_list'=> array(
                array(
    "name" => 'account_name',"value" => urlencode($account_name)),
                array(
    "name" => 'primary_address_street',"value" => urlencode($primary_address_street)),
                array(
    "name" => 'primary_address_postalcode',"value" => urlencode($primary_address_postalcode)),
                array(
    "name" => 'primary_address_city',"value" => urlencode($primary_address_city)),
                array(
    "name" => 'email1',"value" => urlencode($email1)),
                array(
    "name" => 'description',"value" => urlencode($description))
            )
        );

        
    $json json_encode($param_entry_list);
        
    $postArgs 'method=set_entry&input_type=JSON&response_type=JSON&rest_data=' $json;
        
    curl_setopt($curlCURLOPT_POSTFIELDS$postArgs);
        
    $response curl_exec($curl);
        
    $result json_decode($response);
        if (!
    $result->id) {
            
    DEBUG("Fatal Error""Lead Generation Failed");
                    die();
        }
        
    $lead_id $result->id
    Stefan Ulrich Sauer
    System Analyst

    Devoteam Danet GmbH
    Gutenbergstraße 10
    D-64331 Weiterstadt
    Germany
    email: Stefan-Ulrich.Sauer@devoteam.com
    http://www.devoteam.de

  3. #3
    arpita rana is offline Sugar Community Member
    Join Date
    Sep 2011
    Posts
    13

    Thumbs up Re: Save data problem in email_addr_bean_rel

    Quote Originally Posted by sts View Post
    Here is an example for creating a lead using the 'set_entry' method. This works with my 6.2 installation. I removed some lines (I had several more 'name_value_list' entries) to make it shorter. I hope this helps you:

    PHP Code:
        // create a new leads record and grab the leads ID
        
    $param_entry_list=array(
            
    'session'=>$session_id,
            
    'module_name'=>'Leads',
            
    'name_value_list'=> array(
                array(
    "name" => 'account_name',"value" => urlencode($account_name)),
                array(
    "name" => 'primary_address_street',"value" => urlencode($primary_address_street)),
                array(
    "name" => 'primary_address_postalcode',"value" => urlencode($primary_address_postalcode)),
                array(
    "name" => 'primary_address_city',"value" => urlencode($primary_address_city)),
                array(
    "name" => 'email1',"value" => urlencode($email1)),
                array(
    "name" => 'description',"value" => urlencode($description))
            )
        );

        
    $json json_encode($param_entry_list);
        
    $postArgs 'method=set_entry&input_type=JSON&response_type=JSON&rest_data=' $json;
        
    curl_setopt($curlCURLOPT_POSTFIELDS$postArgs);
        
    $response curl_exec($curl);
        
    $result json_decode($response);
        if (!
    $result->id) {
            
    DEBUG("Fatal Error""Lead Generation Failed");
                    die();
        }
        
    $lead_id $result->id
    Thanks for your reply .

    Yes this way we are inserting record but our code insert only in email_address table but we have to insert also in email_addr_bean_rel table ..

    SO how we can insert data in this table because this table ( email_addr_bean_rel) module is not available and this table relation is with email_address table.

    So please help me asap

  4. #4
    arpita rana is offline Sugar Community Member
    Join Date
    Sep 2011
    Posts
    13

    Default Re: Save data problem in email_addr_bean_rel

    Quote Originally Posted by arpita rana View Post
    Thanks for your reply .

    Yes this way we are inserting record but our code insert only in email_address table but we have to insert also in email_addr_bean_rel table ..

    SO how we can insert data in this table because this table ( email_addr_bean_rel) module is not available and this table relation is with email_address table.

    So please help me asap

    Thank you so much for help.

    Now its working by passing 'email1' parameter in Users module .

    please ignore my previous reply.

    Thanks,

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

    Default Re: Save data problem in email_addr_bean_rel

    hello, you can try to insert manually in the table using a code like this:
    PHP Code:
    global $db;
    $query "INSERT INTO yourtable (variable1,variable2,...) VALUES (value1,value2,...)";
    $r $db->query($query); 

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Save data problem in email_addr_bean_rel
    By arpita rana in forum Help
    Replies: 1
    Last Post: 2011-09-20, 07:46 AM
  2. Save relationship data
    By flymirco in forum Developer Help
    Replies: 3
    Last Post: 2010-07-23, 08:59 AM
  3. Replies: 0
    Last Post: 2009-12-17, 07:40 PM
  4. Custom fields don't save any data
    By eringuet in forum Help
    Replies: 21
    Last Post: 2008-04-17, 07:38 AM
  5. how to save custom data
    By anamikakhadwal in forum Help
    Replies: 2
    Last Post: 2007-05-31, 05:58 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
  •