简体   繁体   中英

update customer custom fields from SCA or SSP

I'm trying to update a custom entity field during registration in an SCA app.

the published Netsuite docs indicate I should be able to call:

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

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. Any luck with alternate syntax of some sort?

Eventually was able to get NS support to give me their internal stack trace.

The issue has to do with some internals from the Rhino Javascript engine that NS uses.

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. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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