Saludos a todos,
Alguien me puede decir el código php para crear un caso invocándolo desde un servicio web externo a Sugar,
Para crear un Lead sería algo así:
y quisiera saber como para crear el caso, aparte de los datos de conexión.PHP Code:<?php
define('sugarEntry', TRUE);
//Use the NuSOAP files
require_once('nusoap/nusoap.php');
// change the URL here to point to your Sugar installation
$soapclient = new nusoapclient('http://www.example.com/sugar/soap.php?wsdl',true);
// change the user credentials below to be a valid user id and password for the Sugar
// installation defined above
$user_auth = array(
'user_auth' => array(
'user_name' => 'bob',
'password' => md5('mysecretpassword'),
'version' => '0.1'
),
'application_name' => 'soapleadcapture');
$result_array = $soapclient->call('login',$user_auth);
$session_id = $result_array['id'];
$user_guid = $soapclient->call('get_user_id',$session_id);
// Up until now, we have not introduced anything new
// The following lines will use the set_entry SOAP call to add
// a Lead from a mixture of POST variables and hard coded
// values, then assign to the authenticated Sugar user...
$set_entry_params = array(
'session' => $session_id,
'module_name' => 'Leads',
'name_value_list'=>array(
array('name'=>'first_name','value'=>$_POST['first_name']),
array('name'=>'last_name','value'=>$_POST['last_name']),
array('name'=>'status', 'value'=>'New'),
array('name'=>'phone_work', 'value'=>$_POST['phone']),
array('name'=>'phone_fax', 'value'=>$_POST['fax']),
array('name'=>'account_name','value'=>$_POST['companyname']),
array('name'=>'lead_source','value'=>'Web Site'),
array('name'=>'description','value'=>$_POST['prod_desc']),
array('name'=>'assigned_user_id', 'value'=>$user_guid)));
$result = $soapclient->call('set_entry',$set_entry_params);
// this redirects to a page specified in the previous page...
header("Location: " . $_POST['redirect']);
?>
Gracias.
Ramón.


1Likes
LinkBack URL
About LinkBacks



Reply With Quote
Bookmarks