无法在新的Netsuite记录中设置布尔字段
I am trying to use the Netsuite PHP Toolkit to create a new task, assign it to an employee and have an email sent to that employee.
I can successfully create and assign the task, but can't get the email to send.
Here is the code I'm using:
$task_data = array(
'title'=>$request['subject'],
'assigned'=>new nsRecordRef(array('internalId'=>NETSTUITE_CONF::EMPLOYEE_ID, 'type'=>'employee')),
'message'=>$request['body'],
'sendEmail'=>true,
'startDate'=>date('c', strtotime($request['date_added']))
);
$task = new nsComplexObject('Task', $task_data);
$ret = $ns->add($task);
var_dump($ret);
Which outputs:
object(nsWriteResponse)#13 (3) {
["isSuccess"]=>
bool(true)
["statusDetail"]=>
NULL
["recordRef"]=>
object(nsRecordRef)#19 (4) {
["nsComplexObject_type"]=>
string(9) "RecordRef"
["nsComplexObject_namespace"]=>
string(49) "urn:core_2010_1.platform.webservices.netsuite.com"
["nsComplexObject_fields"]=>
array(2) {
["type"]=>
string(4) "task"
["internalId"]=>
string(6) "408557"
}
["nsComplexObject_namespaces"]=>
NULL
}
}
The new task has all the data set except the sendEmail
field, which the SuiteTalk Schema Browser list the type as xsd:boolean
. I have tried sending the strings "true" and "T" as well, but the field remains false.
How can I set the field to true
, so that the email is sent?
我正在尝试使用Netsuite PHP Toolkit创建新任务,将其分配给员工并发送电子邮件 发送给该员工。 p>
我可以成功创建并分配任务,但无法收到要发送的电子邮件。 p>
这是代码 我正在使用: p>
$ task_data = array(
'title'=> $ request ['subject'],
'已分配'=>新nsRecordRef (array('internalId'=> NETSTUITE_CONF :: EMPLOYEE_ID,'type'=>'employee')),
'message'=> $ request ['body'],
'sendEmail'=> true,
'startDate'=> date('c',strtotime($ request ['date_added']))
);
$ task = new nsComplexObject('Task',$ task_data);
$ ret = $ ns-> add($ task);
var_dump($ ret);
code> pre>
哪些输出: p>
object(nsWriteResponse)#13(3){
[“isSuccess”] =>
bool(true)
[“statusDetail”] =>
NULL
[“recordRef” ] =>
object(nsRecordRef)#19(4){
[“nsComplexObject _type“] =>
string(9)”RecordRef“
[”nsComplexObject_namespace“] =>
string(49)”urn:core_2010_1.platform.webservices.netsuite.com“
[”nsComplexObject_fields“ ] =>
array(2){
[“type”] =>
string(4)“task”
[“internalId”] =>
string(6)“408557”\ n}
[“nsComplexObject_namespaces”] =>
NULL
}
}
code> pre>
新任务包含除 sendEmail code>字段,SuiteTalk Schema Browser将类型列为 xsd:boolean code>。 我也试过发送字符串“true”和“T”,但该字段仍然是假的。 p>
如何将字段设置为 true code>,所以 电子邮件是发送的吗? p>
div>
I got a response from a netsuite employee on their support forum saying:
Adding a task record via web services does not currently support sending of the email when sendemail=true
Try 'T' or 'F' I just did that on a different boolean field elsewhere in netsuite and that's what did the trick for me.