0

Web サービスを使用して顧客データをカスタム フィールド (ビジネス タイプ、顧客市場、地域) に渡そうとしていますが、xml 応答でエラーが発生します。

誰かがアイデアを持っている場合は、phpスクリプトで助けてください

以下は、スクリプトと xml の応答です。

脚本:

        <?

    require_once '../PHPToolkit/NetSuiteService.php';

    $service = new NetSuiteService();
    $customer = new Customer();
    $customer->lastName = "Amit";
    $customer->firstName = "Rathi";
    $customer->companyName = "xxxxxxx.xxx";
    $customer->phone = "123456789";
    $customer->email = "xxxx@xxxxxxx.xxx";


$labName                            = new StringCustomFieldRef();
$labName->internalId                = "custevent12"; // internal id of the input in Netsuite
$labName->value         = "USA East"; // your input

$labName1                            = new StringCustomFieldRef();
$labName1->internalId                = "custevent11"; // internal id of the input in Netsuite
$labName1->value         = "Dealer"; // your input

$labName2                            = new StringCustomFieldRef();
$labName2->internalId                = "custevent14"; // internal id of the input in Netsuite
$labName2->value         = "Residential"; // your input



$customer->customFieldList= new CustomFieldList();
$customer->customFieldList->customField = array($labName1,$labName2,$labName);

    $request = new AddRequest();
    $request->record = $customer;

    $addResponse = $service->add($request);

    if (!$addResponse->writeResponse->status->isSuccess) {
        echo "ADD ERROR";
    } else {
        echo "ADD SUCCESS, id " . $addResponse->writeResponse->baseRef->internalId;
    }

    ?>

XML リクエスト:

    <?xml version="1.0" encoding="UTF-8"?>
    <Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:relationships_2013_1.lists.webservices.netsuite.com" xmlns:ns2="urn:core_2013_1.platform.webservices.netsuite.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns3="urn:messages_2013_1.platform.webservices.netsuite.com" xmlns:ns4="ns"><Header>
<passport xsi:type="Passport"><email>xxxxxx@xxxxx.com</email><password>[Content Removed for Security Reasons]</password><account>xxxxx</account><role internalId="3"/></passport></Header>
<Body><add><record xsi:type="Customer"><firstName>Rathi</firstName><lastName>Amit</lastName><companyName>Live2support.com</companyName><phone>123456789</phone><email>xxx@xxxxxx.com</email><customFieldList><customField internalId="custevent11" xsi:type="StringCustomFieldRef"><value>[Content Removed for Security Reasons]</value></customField><customField internalId="custevent14" xsi:type="StringCustomFieldRef"><value>[Content Removed for Security Reasons]</value></customField><customField internalId="custevent12" xsi:type="StringCustomFieldRef"><value>[Content Removed for Security Reasons]</value></customField></customFieldList></record></add></Body></Envelope>

応答:

        <?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Header><platformMsgs:documentInfo xmlns:platformMsgs="urn:messages_2013_1.platform.webservices.netsuite.com"><platformMsgs:nsId>WEBSERVICES_3434906_10312013233905655255582218_d18e16e7454b3</platformMsgs:nsId></platformMsgs:documentInfo></soapenv:Header><soapenv:Body><addResponse xmlns="urn:messages_2013_1.platform.webservices.netsuite.com">
<writeResponse>
<platformCore:status isSuccess="false" xmlns:platformCore="urn:core_2013_1.platform.webservices.netsuite.com"><platformCore:statusDetail type="ERROR">
<platformCore:code>USER_ERROR</platformCore:code>
<platformCore:message>Please enter value(s) for: Business Type, Customer Market, Regions</platformCore:message>
</platformCore:statusDetail></platformCore:status></writeResponse></addResponse></soapenv:Body></soapenv:Envelope>
4

2 に答える 2

1

これらのカスタム フィールドは、必須フィールドとして定義する必要があります。を使用して、これらのカスタム フィールドに値を指定します。

$customer->customFieldList->customField = array();

ヘルプについては、こちらのサンプルを参照してください https://github.com/TribeHR/NetSuite-PHP-Client/blob/master/samples/add_with_multiple_custom_fields.php

于 2013-10-31T08:12:56.697 に答える