简体   繁体   English

从SCA或SSP更新客户定制字段

[英]update customer custom fields from SCA or SSP

I'm trying to update a custom entity field during registration in an SCA app. 我正在尝试在SCA应用程序中注册期间更新自定义实体字段。

the published Netsuite docs indicate I should be able to call: 已发布的Netsuite文档指示我应该可以致电:

var webStore = session.getSiteSettings(['displayname', 'id']);
customer = session.getCustomer();
customer.updateProfile({
internalid: internalid,
customfields: {
    custentity_registered_site: webstore.id
}
});

but this throws the ever helpful UNEXPECTED_ERROR 但这会抛出有益的UNEXPECTED_ERROR

Has anyone had this working for custom fields? 有人在自定义字段上工作吗? I am doing this just after registration so that may be the issue though I can get a valid customer internalid. 我在注册后就这样做了,尽管我可以获得有效的客户内部ID,但这可能是个问题。 Any luck with alternate syntax of some sort? 使用某种替代语法有运气吗?

Eventually was able to get NS support to give me their internal stack trace. 最终能够获得NS支持,从而为我提供了内部堆栈跟踪。

The issue has to do with some internals from the Rhino Javascript engine that NS uses. 该问题与NS使用的Rhino Javascript引擎的某些内部组件有关。

Basically the value returned from the NS API was returning a string like value and NS was not following the 2014 recommendation on its use and was failing in the underlying Java code. 基本上,从NS API返回的将返回类似value字符串,并且NS并未遵循2014年的使用建议,并且底层Java代码失败。 So the fix was simple but so frustrating: 因此修复很简单,但令人沮丧:

var webStore = session.getSiteSettings(['displayname', 'id']);
customer = session.getCustomer();
customer.updateProfile({
    internalid: internalid,
    customfields: {
        custentity_registered_site: webstore.id.toString()
    }
});

Hope this helps someone. 希望这对某人有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM