[Vtigercrm-developers] Examples of new Webservices functions?

Manu urs manu.k at vtiger.com
Tue Jul 21 12:43:28 GMT 2015


Hi

Here is some information about  it .

1) *vtws_relatedtypes($elementType, $user)*

                   This Api help us to retrieve the related module list .

Parameters :  $elementType  is a module name
                     $user  is a user object


> *ex  :  $result = vtws_relatedtypes("Contacts", $user);*


Returns a  array of module which are related to contact module.

> Array
> (
>     [types] => Array
>          (
>
                    // related module list
         )
    [information] => Array
        (
                 // Related modules name , label ,the entity information
          )
)



*2)  vtws_retrieve_related($id, $relatedType, $relatedLabel, $user)  *

            This api help us to retrieve the related record information.

Parameters : $id  is   combination  of web service module id and record id
                    $relatedType  is a related module name
                    $relatedLabel   is a  related module label (can be get
from vtws_relatedtypes )
                    $user  is a user object


> *ex : $result = vtws_retrieve_related('4x64', 'HelpDesk', 'HelpDesk',
> $user);*
>

   This will return all  Tickets which is related to the contact id =64 ,
where 4 is a webservice entity id (vtiger_ws_entity)



* 3) vtws_query_related($query, $id, $relatedLabel, $user, $filterClause =
null)      *

         This api  is same as  * vtws_retrieve_related ,* in additional to
it will accept the query to fetch the record.


Parameters :
                    $query : Query need to be pass.
                    $id  is   combination  of webservice module id and
record id
                    $relatedLabel   is a  related module label (can be get
from vtws_relatedtypes )
                   $user  is a user object.

* ex :  $result =vtws_query_related("SELECT * FROM HelpDesk WHERE
> ticket_title='helo ticket'", '4x64', 'HelpDesk', $user);*
>

  This will return all  Tickets with title  = "helo ticket" which is
related to the contact id =64  , where 4 is a webservice entity id
(vtiger_ws_entity)  .





Regards,
Manu Urs


On Tue, Jul 21, 2015 at 5:01 PM, Alan Lord <alanslists at gmail.com>
wrotprint_r($user);
die;e:

> On 21/07/15 12:12, Christophe Humbert wrote:
>
>> Hello Alan,
>>
>> Indeed would be interesting to get some info...I imagine and to know if
>> it will be included in vtwslib 1.?
>>
>
> Some tests:
>
>  $relatedTypes = vtws_relatedtypes('Accounts',$current_user);
>>
>
> $relatedTypes contains a response like:
>
>  Array
>> (
>>     [types] => Array
>>         (
>>             [0] => Contacts
>>             [1] => Potentials
>>             [2] => Quotes
>>             [3] => SalesOrder
>>             [4] => Invoice
>>             [5] => Calendar
>>             [6] => Emails
>>             [7] => Calendar
>>             [8] => Documents
>>             [9] => HelpDesk
>>             [10] => Products
>>             [11] => Campaigns
>>             [12] => Services
>>             [13] => PBXManager
>>             [14] => ServiceContracts
>>             [15] => Project
>>             [16] => Assets
>>         )
>>
>>     [information] => Array
>>         (
>>             [Contacts] => Array
>>                 (
>>                     [name] => Contacts
>>                     [label] => Contacts
>>                     [isEntity] => 1
>>                 )
>>
>>             [Potentials] => Array
>>                 (
>>                     [name] => Potentials
>>                     [label] => Potentials
>>                     [isEntity] => 1
>>                 )
>>
>>             [Quotes] => Array
>>                 (
>>                     [name] => Quotes
>>                     [label] => Quotes
>>                     [isEntity] => 1
>>                 )
>>
> ...
>
> there is no information about the nature of the relationship. I'm not sure
> how useful this function could be really.
>
> The other function that appears to be designed to called is the
> vtws_retrieve_related function but I cannot get this to return anything
> useful:
>
> $typeInformation = vtws_retrieve_related('11', 'Contacts', 'Contacts',
> $current_user);
>
> returns:
>
>  Permission to perform the operation is denied for name
>>
>
> Al
>
>
>
>
>
>
>
>
> _______________________________________________
> http://www.vtiger.com/
>



-- 
Regards,
Manu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.vtigercrm.com/pipermail/vtigercrm-developers/attachments/20150721/a76a2c15/attachment.html>


More information about the vtigercrm-developers mailing list