[英]How to create an Activity with vTiger webservice?
I'm traying to create an activity using php. 我正在使用php创建活动。
I don't know why, the last var_dump is like "boolean false". 我不知道为什么,最后一个var_dump就像“布尔假”。 This is my code.
这是我的代码。
$today=getdate();
$today=date("Y-m-d");
var_dump($today);
$modulet='Calendar';
$insertt= Array(
'subject'=>'Call',
'activitytype'=>'Task',
'date_start'=>$today,
'due_date'=>$today,
'assigned_user_id'=>$vtiger->_userid ,
'time_start'=>'09:00:00',
'time_end'=>'17:00:00',
'sendnotification'=>'0',
'status'=>'Not Started',
'priority'=>'High',
'notime'=>'0',
'visibility'=>'Private'
);
var_dump($insertt);
$recordtask = $client->doCreate($modulet, $insertt);
var_dump($recordtask);
Check that the $vtiger->_userid
is in the form 19x1
(module X user_id) and not just the integer value (eg 1
). 检查
$vtiger->_userid
19x1
$vtiger->_userid
的格式是否为19x1
(模块X user_id),而不仅仅是整数值(例如1
)。 You could actually omit it if using the WSClient.php from the vtwsclib from vTiger. 如果使用vTiger的vtwsclib中的WSClient.php,则实际上可以忽略它。
This is the doCreate code. 这是doCreate代码。
/**
* Do Create Operation
*/
function doCreate($module, $valuemap) {
// Perform re-login if required.
$this->__checkLogin();
// Assign record to logged in user if not specified
if(!isset($valuemap['assigned_user_id'])) {
$valuemap['assigned_user_id'] = $this->_userid;
}
$postdata = Array(
'operation' => 'create',
'sessionName' => $this->_sessionid,
'elementType' => $module,
'element' => $this->toJSONString($valuemap)
);
$resultdata = $this->_client->doPost($postdata, true);
if($this->hasError($resultdata)) {
return false;
}
return $resultdata[result];
}
Maybe you want to var_dump
the $resultdata
instead of the result from the library, which is simply a boolean 也许您想
var_dump
$resultdata
而不是库的结果,这只是一个布尔值
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.