[Vtigercrm-developers] Create a Lead in Web service using vtwsclib 1.5

Christophe Humbert chrissc.humbert at gmail.com
Tue Jun 16 21:16:13 GMT 2015


Hello All

I have used a lot of functions to be sure of the Group Id etc...
<?php
$file = realpath('vtwsclib');
include_once $file.'/Vtiger/WSClient.php';
$url = 'https://www.lib-assur.com/vtiger';
$client = new Vtiger_WSClient($url);
$login = $client->doLogin('user', 'key');
if(!$login) echo 'Login Failed';
else {
    /*echo "Session: : ".$client->sessionId;
    $modules = $client->doListTypes();
    $c=1;
    foreach($modules as $modulename => $moduleinfo) {
        echo "ModuleName: ".$modulename." ".$c."\n<BR>";
        $c++;
    }

    $module = 'Groups';
    $describe = $client->doDescribe($module);
    $fields = $describe[fields];
    for($i=0; $i<count($fields); $i++) {
        echo $fields[$i]['name']."</br>";
    }*/
    // Retrieve Groups
    $query = "SELECT * FROM Groups WHERE groupname LIKE 'Team%'";
    $records = $client->doQuery($query);
    if($records) {
        //$columns = $client->getResultColumns($records);
        foreach($records as $record) {
            $groupid = $record['id'];
            // Process record information
            /*foreach($columns as $column)
                echo $column."<br>";*/
        }
    }

    $record = $client->doCreate($module, Array('lastname'=>'Test_LS1',
'company'=>'Test1', 'assigned_user_id'=>$groupid));
    if($record) {
        echo "done";
        //$recordid = $client->getRecordId($record['id']);
        //echo "Record ".$recordid;
    }
    else {
        $wasError= $client->lastError();
        if($wasError) {
            echo "</br>last error : ".$wasError['code'] . ':' .
$wasError['message'];
        }

    }
}
?>

That is working if I don't try to doCreate with assigned_user_id but as
soon as i use this in do create I have the following error
ACCESS_DENIED:Permission to perform the operation is denied

and the user I am using is admin...a bug or something...

Thanks for any hint


Christophe Humbert


On Tue, Jun 16, 2015 at 9:22 AM, Christophe Humbert <
chrissc.humbert at gmail.com> wrote:

> Hello Estevan
>
> I am using the doCreate method but what I can have wrong is the Entity Id
> of Group on vtiger 6.2 I thought it was 28...because when assigning with
> user it is working...
>
> PS: how do you use the debug method, sorry for stupid question but I am
> not a dev.
>
> Thanks for your valuable help
>
> Christophe Humbert
>
>
>
> On Tue, Jun 16, 2015 at 6:29 AM, estevan <estefan.civera at gmail.com> wrote:
>
>> try with vtws_create and debug it to discover why it fails, then come back
>> and use web service doCreate method
>>
>>
>>
>>
>>
>> -----
>> Ing. Estefan Civera
>> Vtiger developer and consultant
>> http://www.estefancivera.net
>> Italy
>> --
>> View this message in context:
>> http://vtiger-crm.2324883.n4.nabble.com/Vtigercrm-developers-Create-a-Lead-in-Web-service-using-vtwsclib-1-5-tp16558p16580.html
>> Sent from the vtigercrm-developers mailing list archive at Nabble.com.
>> _______________________________________________
>> http://www.vtiger.com/
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.vtigercrm.com/pipermail/vtigercrm-developers/attachments/20150616/3d5516df/attachment.html>


More information about the vtigercrm-developers mailing list