0

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.

sazr
  • 24,984
  • 66
  • 194
  • 362
  • Could you show where are you declaring customer and session please? – Adolfo Garza Jun 29 '17 at 04:13
  • @AdolfoGarza thanks for your comment. FYI I incorrectly stated the file was `Modules\...\Account.Model.js` when it is actually `Modules\...\Profile.Model.js`. Re; where I declare `customer` and `session`, I don't. If you are familiar with the SCA suitescript file `Modules\suitecommerce\Profile@2.1.0\SuiteScript\Profile.Model.js` you'll see its `get` function also doesn't declare these variables. So I assume they are global. The user is logged in and secure because the code executes and can retrieve the users first name, last name, etc. Just `salutation` fails. – sazr Jun 29 '17 at 05:59

0 Answers0