我尝试通过 RESTlet API 调用已保存的搜索,并且已部署 RESTlet,但在尝试运行它时,出现以下错误:
错误代码:INVALID_RETURN_DATA_FORMAT
错误消息:数据格式无效。您应该返回 TEXT。
查看我的脚本,我无法确定错误在哪里。下面是我尝试运行的脚本
function GetSearchResult(){
//array container for search results
var output = new Array();
//get search results
var results = nlapiSearchRecord('transaction','customsearchid',null,null);
var columns = results[0].getAllColumns();
//loop through the search results
for(var i in results){
//create placeholder object place holder
var obj = new searchRow(
//set the values of the object with the values of the appropriate columns
results[i].getValue(columns[0]),
results[i].getValue(columns[1]),
results[i].getValue(columns[2]),
results[i].getValue(columns[3]),
results[i].getValue(columns[4]),
results[i].getValue(columns[5]),
results[i].getValue(columns[6]),
results[i].getValue(columns[7]),
results[i].getValue(columns[8]),
results[i].getValue(columns[9]),
results[i].getValue(columns[10]),
results[i].getValue(columns[11]),
results[i].getValue(columns[12])
);
//add the object to the array of results
output.push(obj);
}
//return the array of search objects
return output;
}
//Object to serve a place holder for each search row
function searchRow(internalid,lineid,subsidiaryid,locationid,departmentid,accountid,date,name,memo,amount,uniqueid,product,period){
this.internalid = internalid;
this.lineid = lineid;
this.subsidiaryid = subsidiaryid;
this.locationid = locationid;
this.departmentid = departmentid;
this.accountid = accountid;
this.date = date;
this.name = name;
this.memo = memo;
this.amount = amount;
this.uniqueid = uniqueid;
this.product = product;
this.period = period;
}
Run Code Online (Sandbox Code Playgroud)
谢谢!
| 归档时间: |
|
| 查看次数: |
5223 次 |
| 最近记录: |