Description
Gets read-only information about the current web store visitor. If the visitor is logged in as a user, you can get details such as the user’s first name and last name, the user’s addresses, credit limit, current balance, and more. Refer to the UserProfileInfo object for a list of all properties.
If a web store visitor is not logged in, this method returns a smaller set of properties. Note that visitors may be recognised even if they are not logged in. You can check for this with the isrecognized property of the UserProfileInfo object.
This method returns a predefined set of fields from the customer record in NetSuite, as specified in the UserProfileInfo object definition. It may also return custom fields from the customer record. Custom fields are returned only if the Web Site box is checked on the Applies To tab on the custom field record. See Creating a Custom Field in the NetSuite Help Center for more information about how to create custom fields.
var userprofilecomponent = container.getComponent("UserProfile");
userprofilecomponent.getUserProfile().then(function(profile) {
firstname = profile.firstname;
lastname = profile.lastname;
fullname = firstname + " " + lastname;
console.log("User: Full Name: " + fullname);
});