使用 SuiteScript 2.0 获取应用记录的实际记录
Get actual record of applied record with SuiteScript 2.0
我希望在执行客户退款之类的操作时能够从应用的记录中获取 shipping/billing 地址。
这是我从应用记录中看到的数据:
amount = {string} 2.56
apply = {string} T
applydate = {string} 11/6/2018
createdfrom = {object} null
doc = {string} 792
due = {string} 2.56
duedate = {object} null
internalid = {string} 792
line = {string} 1
pymt = {object} null
refnum = {string} 63
sys_id = {string} 4917587510484347
sys_parentid = {string} 4917587510342093
total = {string} 2.56
trantype = {string} CustPymt
type = {string} Payment
我最初尝试使用 record.Load
函数来执行此操作。问题是这个函数需要传入记录类型,在应用子列表中没有明确给出。我最初尝试使用 type
字段,但正如您在上面看到的那样。正确的类型是 record.Type.CUSTOMER_PAYMENT
,这里的值只显示为 Payment
。我切换到使用 trantype
并具有映射功能,但我没有所有可能的映射。
我的问题是:
- 是否有更好的方法从应用记录中获取运输和账单信息
- 如果 1 的答案是否定的,有没有办法从应用子列表中获取实际记录类型?
- 如果对 2 的回答是否定的,有没有什么地方有
trantype
到 record.Type
的所有可能映射?
您可以使用 search.Type.TRANSACTION 查找地址值,如下所示:
var addressValues = search.lookupFields({
type: search.Type.TRANSACTION,
id: 792,
columns: ['shipaddress', 'billaddress']
});
NetSuite 中的地址是不同的记录,链接在这里。所以你必须使用搜索,如上所述。
我希望在执行客户退款之类的操作时能够从应用的记录中获取 shipping/billing 地址。
这是我从应用记录中看到的数据:
amount = {string} 2.56
apply = {string} T
applydate = {string} 11/6/2018
createdfrom = {object} null
doc = {string} 792
due = {string} 2.56
duedate = {object} null
internalid = {string} 792
line = {string} 1
pymt = {object} null
refnum = {string} 63
sys_id = {string} 4917587510484347
sys_parentid = {string} 4917587510342093
total = {string} 2.56
trantype = {string} CustPymt
type = {string} Payment
我最初尝试使用 record.Load
函数来执行此操作。问题是这个函数需要传入记录类型,在应用子列表中没有明确给出。我最初尝试使用 type
字段,但正如您在上面看到的那样。正确的类型是 record.Type.CUSTOMER_PAYMENT
,这里的值只显示为 Payment
。我切换到使用 trantype
并具有映射功能,但我没有所有可能的映射。
我的问题是:
- 是否有更好的方法从应用记录中获取运输和账单信息
- 如果 1 的答案是否定的,有没有办法从应用子列表中获取实际记录类型?
- 如果对 2 的回答是否定的,有没有什么地方有
trantype
到record.Type
的所有可能映射?
您可以使用 search.Type.TRANSACTION 查找地址值,如下所示:
var addressValues = search.lookupFields({
type: search.Type.TRANSACTION,
id: 792,
columns: ['shipaddress', 'billaddress']
});
NetSuite 中的地址是不同的记录,链接在这里。所以你必须使用搜索,如上所述。