I want to add SalesOrder through vTiger webservice. I'm using for this vtwsclib. Here is the code:
<?php
include_once('vtwsclib/Vtiger/WSClient.php');
$url = 'http://localhost:8888';
$client = new Vtiger_WSClient($url);
$login = $client->doLogin('admin', 'zzzzzzzz');
if(!$login) echo 'Login Failed';
else {
$data = array(
'subject' => 'Test SalesOrder',
'sostatus' => 'Created',
'invoicestatus'=>'AutoCreated',
'account_id'=> '46', // Existing account id
'bill_street' => 'Bill Street',
'ship_street' => 'Ship Street',
);
$record = $client->doCreate('SalesOrder', $data);
$error = $client->lasterror();
if($error) {
echo $error['code'] . ' : ' . $error['message'];
}
if($record) {
$salesorderid = $client->getRecordId($record['id']);
}
}
?>
And I get only: "ACCESS_DENIED : Permission to perform the operation is denied for id".
Account_id exists in database. Other SalesOrder was added with the same account_id but through webpage. I have also tried variant with accout_id = "6x46" where 6 is module_id. It also didn't work. Any ideas how to solve this problem?
I think you should be trying 11x46 for account id. Vtiger web services entity id's are different from tabids.
To get a correct list of all entity ids, execute this in your MySQL for the CRM:
This is a method that might helps you to generate query
q
for exemple you expect :
you can do
this is the function :
i didn't take XSS injection into consideration because my expected query
q
will be written in the urlProblem lies in vtiger documentation. add entityName parameter in GET request.
This worked well for me. Although still couldn't understand that by giving any entityName or garbage string, program works !!! Please comment if you know more about this.