title: SOAP 4 set_relationship not working
body: <p>After battling for getting more than 20 entries with <code>get_entry_list</code>, i'm now trying to use the SOAP API on SugarCRM 6.5 to set a relationship between two elements, created from a form on the user-land website.</p>
  
  <p>The <code>set_relationship</code> method is described as following in the devs blog :</p>
  
  <pre><code>$response = set_relationship(session, module_name, module_id, link_field_name, related_ids, name_value_list, delete);
  </code></pre>
  
  <p>So here is the code which handles the request, assuming that another part of the code handles the security.</p>
  
  <pre><code>$values = array(    'id_frame' =&gt; $_POST['id_frame'],
                      'id_battery' =&gt; $_POST['id_battery'],
                      'reseller' =&gt; $_POST['reseller'],
                      'date_purchase' =&gt; $_POST['date_purchase'],
                      'products_versionning' =&gt; $_POST['product_purchased'],
                      'first_name' =&gt; $_POST['first_name'],
                      'last_name' =&gt; $_POST['name'],
                      'phone_home' =&gt; $_POST['phone'],
                      'email' =&gt; $_POST['email'],
                      'primary_address_street' =&gt; $_POST['address'],
                      'primary_address_street_2' =&gt; $_POST['address2'],
                      'primary_address_street_city' =&gt; $_POST['city'],
                      'primary_address_street_postalcode' =&gt; $_POST['zip'],
  
  );
  
  try{
      $prod_register = $soapClient-&gt;set_entry(
      $sessid,
      'myco_product_register',
      array(  array('name' =&gt; 'id_frame',                         'value' =&gt; $values['id_frame']),
              array('name' =&gt; 'id_battery',                       'value' =&gt; $values['id_battery']),
              array('name' =&gt; 'date_purchase',                    'value' =&gt; $values['date_purchase']),
              array('name' =&gt; 'first_name',                       'value' =&gt; $values['first_name']),
              array('name' =&gt; 'last_name',                        'value' =&gt; $values['last_name']),
              array('name' =&gt; 'phone_home',                       'value' =&gt; $values['phone_home']),
              array('name' =&gt; 'email',                            'value' =&gt; $values['email']),
              array('name' =&gt; 'primary_address_street',           'value' =&gt; $values['primary_address_street']),
              array('name' =&gt; 'primary_address_street_city',      'value' =&gt; $values['primary_address_street_city']),
              array('name' =&gt; 'primary_address_street_postalcode','value' =&gt; $values['primary_address_street_postalcode']),
              array('name' =&gt; 'description','value' =&gt; "ModÃ¨le : " . $values['products_versionning'] . "\nAchetÃ© le " . $values['date_purchase'] . " Ã  " . $values['reseller']),
          )
      );
  
      $client = $soapClient-&gt;set_entry(
      $sessid,
      'Accounts',
      array(  array('name' =&gt; 'name',                             'value' =&gt; $values['first_name'] . ' ' . $values['last_name']),
              array('name' =&gt; 'billing_address_street',           'value' =&gt; $values['primary_address_street']),
              array('name' =&gt; 'billing_address_city',             'value' =&gt; $values['primary_address_street_city']),
              array('name' =&gt; 'billing_address_postalcode',       'value' =&gt; $values['primary_address_street_postalcode']),
          )
      );
  
      $entry_id = $prod_register-&gt;id;
  
      $relationship_parameters = array(
          "module1" =&gt; "myco_product_register",
          "module1_id" =&gt; array($entry_id),
          "module2" =&gt; "myco_products_versionning",
          "module2_id" =&gt; array($values['products_versionning'])
      );
  
  
      //Now i'm setting the relationships
          $response = $soapClient-&gt;set_relationship($sessid, "myco_product_register", $entry_id,
                  'myco_products_versionning_id_c', $values['products_versionning'], array(), 0);
  
          $response = $soapClient-&gt;set_relationship($sessid, "myco_product_register", $entry_id,
                  'myco_resellers_id_c', $values['reseller'], array(), 0);
  </code></pre>
  
  <p>Both <code>set_entry</code> requests work and return a working id, but no one of the relationships work (<code>$responses</code> contains a <code>failed</code> equal to 1). So that's not a connection problem or such.</p>
  
  <p>Talking about the relationships, one guy from the devblog said that </p>
  
  <ul>
  <li>there has to be a relationship between the two modules</li>
  <li>there has to be at least one <code>related field</code> in the module which handle the relation, whose name you can find in the module's <code>vardefs.php</code></li>
  </ul>
  
  <p>and i have</p>
  
  <ul>
  <li>A <code>One-to-one</code> relationship between the <code>product_register</code> module and both <code>products_versionning</code> and <code>resellers</code></li>
  <li>A <code>related field</code> in <code>product_register</code> for each related module.</li>
  </ul>
  
  <p>What may i be missing ?</p>