In NetSuite SuiteCommerce Advanced I am attempting to get the currently logged in users title (Mr, Mrs, etc.).
I am using the Commerce API
and the function Customer::getFieldValues()
. I am retrieving the column/field name salutation
. When I execute this function it returns an empty object when it should return the users title/salutation. Note: I have confirmed the user has a title/salutation set as 'Mr'.
Any advice why SCA is not returning the user's title? This is sooo annoying of NS!
*Modules\MyOverrides\ProfileOverrides@1.0.0\SuiteScript\Profile.Model.js
:
define('Profile.Model',['SC.Model', 'underscore', 'Utils'], function (SCModel, _, Utils)
{
'use strict';
return SCModel.extend({
name: 'Profile'
, get: function ()
{
//You can get the profile information only if you are logged in.
if (this.isLoggedIn && this.isSecure)
{
// Retrieve the currently logged in users saluation (eg Sir, Mr, Mrs, etc.)
// Why on earth does NS not return this!!!
var profile = customer.getFieldValues(['salutation']);
console.log("PROFILE", profile); // outputs "PROFILE {}"
...
*Edit: I incorrectly stated the file was
Modules\MyOverrides\AccountOverrides@1.0.0\SuiteScript\Account.Model.js
: when it is actually Modules\MyOverrides\ProfileOverrides@1.0.0\SuiteScript\Profile.Model.js
.