如何为Webservice VtigerCRM创建自定义操作? [英] How to Create custom operation for Webservice VtigerCRM?

查看:141
本文介绍了如何为Webservice VtigerCRM创建自定义操作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是vtigercrm的新手.我想要一个自定义操作,以使用Web服务从 vtiger_tab 表中获取所有模块.

I am new in vtigercrm. I want need a custom operation to get all modules from vtiger_tab table by using webservice.

如何为Web服务Vtiger CRM创建自定义操作?

How do I Create a custom operation for Web service Vtiger CRM?

推荐答案

要定义新的Web服务自定义方法,您必须操纵2个表vtiger_ws_operation和vtiger_ws_operation_parameters 首先通过执行

To define a new webservice custom method you have to manipolate 2 tables vtiger_ws_operation and vtiger_ws_operation_parameters First declare the mathod name and handler by executing a query like

INSERT INTO `vtiger_ws_operation` ( `name`, `handler_path`, `handler_method`, `type`, `prelogin`) VALUES ('my_webservice_method', 'include/Webservices/MyWebserviceMethod.php', 'vtws_my_webservice_method’, 'GET', 0);

假设插入的记录的字段operationid等于34,现在必须使用类似查询的参数向vtiger_ws_operation_parameters添加参数

Suppose that the inserted record has the field operationid equals to 34, now you must add parameters to vtiger_ws_operation_parameters with a query like

INSERT INTO `vtiger_ws_operation_parameters` (`operationid`, `name`, `type`, `sequence`) VALUES (34, 'id', 'String', 1);

并继续使用最后一个字段的增量值

and continue with incremental values for the last field

INSERT INTO `vtiger_ws_operation_parameters` (`operationid`, `name`, `type`, `sequence`) VALUES (34, ‘param_99’, 'String', 99);

由于第一个查询,现在您必须在include/Webservices/文件夹中创建一个名为MyWebserviceMethod.php的文件. 在此文件中,将有一个名为vtws_my_webservice_method的函数,像这样

Due to the first query, now you must create a file named MyWebserviceMethod.php in the folder include/Webservices/ In this file there will be a function called vtws_my_webservice_method like this

<?php

function vtws_my_webservice_method($id, $user){

    global $log,$adb;
    …..
    return $something;
}?>

这篇关于如何为Webservice VtigerCRM创建自定义操作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆