[Vtigercrm-developers] Convert Lead web services
Christophe Humbert
chrissc.humbert at gmail.com
Sun Mar 20 16:30:01 GMT 2016
Hello Guys
I have a small issue with convert lead web services
The retrieve information are OK no issue
But I have access denied each time I am trying t convert lead...(exact
message is ACCESS_DENIED:Permission to perform the operation is denied for
id)
So i tried as you have seen below with user which is admin for the
assigned_user_id....
So if anyone as an idea on how to solve that
Vtiger 6.2
$recordInfo = $client->doRetrieve($id);
echo 'show: ' .$recordInfo['assigned_user_id'];
$convert_lead_array = array();
$convert_lead_array['leadId'] = $recordInfo['id'];
//$convert_lead_array['assignedTo'] =
$recordInfo['assigned_user_id'];
$convert_lead_array['assignedTo'] = '19x5';
$convert_lead_array['entities']['Accounts']['create']=true;
$convert_lead_array['entities']['Accounts']['name']='Accounts';
$convert_lead_array['entities']['Accounts']['accountname'] =
$recordInfo['company'];
$convert_lead_array['entities']['Accounts']['industry']=$recordInfo['industry'];
$convert_lead_array['entities']['Potentials']['create']=true;
$convert_lead_array['entities']['Potentials']['name']='Potentials';
$convert_lead_array['entities']['Potentials']['potentialname']=$recordInfo['company'];
//$convert_lead_array['entities']['Potentials']['closingdate']=
date("Y-m-d", strtotime("+1 week Saturday"));
$convert_lead_array['entities']['Potentials']['sales_stage']=
'Subscription requested';
$convert_lead_array['entities']['Potentials']['amount']= 0;
$convert_lead_array['entities']['Contacts']['create']=true;
$convert_lead_array['entities']['Contacts']['name']='Contacts';
$convert_lead_array['entities']['Contacts']['lastname']=$recordInfo['lastname'];
$convert_lead_array['entities']['Contacts']['firstname']=$recordInfo['firstname'];
$convert_lead_array['entities']['Contacts']['email']=$recordInfo['email'];
//Encode in json for the webservice consumption
$convert_lead_json = json_encode($convert_lead_array);
$response = $client->doInvoke('convertlead',
array('element'=>$convert_lead_json));
$wasError = $client->lastError();
if($wasError) {
return $wasError['code'] . ':' . $wasError['message'];
} else {
return 1;
}
Thanks
Christophe Humbert
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.vtigercrm.com/pipermail/vtigercrm-developers/attachments/20160320/62c1f2a3/attachment.html>
More information about the vtigercrm-developers
mailing list