NetSuite SuiteScript修改文件柜中的文件 [英] NetSuite SuiteScript to modify file in the file cabinet
问题描述
我们在NetSuite文件中有一些文件需要更新(URL字段已更改).我在此站点上找到了该文章,但没有代码示例可以执行所请求的操作.它指示使用nlapiLoadFile和nlapiSubmitFile调用;任何人都可以协助编写代码示例吗?
We have files within the NetSuite file cabient which need to be updated (the url field has changed). I found the noted article on this site but there is no code example to perform the requested. It indicates to use the nlapiLoadFile and nlapiSubmitFile calls; would anyone be able to assist with a code example?
链接: Netsuite Suitescript可以修改文件柜中的文件吗?
推荐答案
没有特殊的API函数来编辑现有文件,您可以获取现有文件的详细信息并创建具有相同详细信息的新文件,但要更改数据字段,并删除旧文件.
There is no special API function to edit an existing file, you could take the details of the existing file and create a new file with the same details but changing the data field only and deleting the old file.
var start = function(request, response)
{
var fileId = "107524";//get the existing file id
var file = nlapiLoadFile(fileId);
var data = file.getValue();
var name = file.getName();
var folderId = file.getFolder();
var fileType = file.getType();
nlapiDeleteFile(fileId);//delete the older file
data += ",this is the appended data";//change the data
var newFile = nlapiCreateFile(name, fileType, data);//create a new file with the same details
newFile.setFolder(folderId);
nlapiSubmitFile(newFile);//submit it
}
这篇关于NetSuite SuiteScript修改文件柜中的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!