在Netsuite中使用RESTlet传递电话号码的值时获取错误

时间:2015-12-31 06:54:07

标签: php restlet netsuite

在Netsuite中,允许至少7个字符。我可以直接从UI保存Netsuite中的电话号码+1(313)。但是如果我尝试使用RESTlet保存相同的数字+1(313),我会收到以下错误:

Array
(
    [error] => Array
        (
            [code] => INVALID_FLD_VALUE
            [message] => You have entered an Invalid Field Value +1(313) for the following field: altphone
        )

)

我的请求数据是:

Array
(
    [recordtype] => lead
    [id] => xxxxx
    [columnname] => Array
        (
            [0] => altphone
        )

    [columnvalues] => Array
        (
            [0] => +1(313)
        )
)

Working:
 +916(313) [can save directly on netsuite and also RESTlet]
Not working:
 +1(313) [can save directly on netsuite]
+91(313) [can save directly on netsuite]

My Restlet脚本用于更新:

function update_record(datain) {
    var record = nlapiLoadRecord(datain.recordtype, datain.id);
    for ( var i in datain.columnname) {
        record.setFieldValue(datain.columnname[i], datain.columnvalues[i]);
    }
    var results = nlapiSubmitRecord(record);
    return results;
}

1 个答案:

答案 0 :(得分:1)

好吧,我在SuiteScript Debugger和浏览器控制台中尝试了以下代码:

x = nlapiLoadRecord('lead', RECORD_ID);
x.setFieldValue('altphone', '+1(313)');
nlapiSubmitRecord(x);

它从代码失败,但是,它从UI成功。因此,它将在RESTlet中失败,并且在任何SuiteScript中都会失败。