AnsweredAssumed Answered

Create a lead in sugarCRM using User Id

Question asked by Xtream Xtream on Jun 3, 2015
Latest reply on Jun 5, 2015 by Rolustech Rolustech
Is it possible to create lead in sugarCRM using User ID.

For Example :

$parameters = array(
    'session' => $session, //sessionId
    'module' => 'Leads',  //Module name
    'name_value_list' => array (
            array('name' => 'first_name', 'value' => 'name'),
            array('name' => 'last_name', 'value' => 'name'),
            array('name' => 'status', 'value' => 'New'),
            array('name' => 'lead_source', 'value' => 'Web Site')
$json = json_encode($parameters);
$postArgs = 'method=set_entry&input_type=JSON&response_type=JSON&rest_data=' . $json;

curl_setopt($curl, CURLOPT_POSTFIELDS, $postArgs);

// Make the REST call, returning the result
$response = curl_exec($curl);

// Convert the result from JSON format to a PHP array
$result = json_decode($response,true);

// Get the newly created record id
$recordId = $result['id'];

print "New Record Created with ID ".$recordId;

In REST API Creating lead we are using user session.Instead of user session "$session". Can we user user id fro creating the laed in REST API. Any option available for this please suggest?