How to find whether the logged in user is an indiv...
# ask-stanley-ai
a
How to find whether the logged in user is an individual or company using suitecommerce frontend extensibility API
c
AI generated answer (using internal Slack threads):
To determine whether the logged in user is an individual or a company using the SuiteCommerce Frontend Extensibility API, you would need to access the customer information within an extension. You can use the
Profile.Model
to access the customer's information. However, the specific field to determine whether the user is an individual or a company may vary depending on your NetSuite setup. For example, if you have a custom field that specifies whether the customer is an individual or a company, you can access this field using the
Profile.Model
. Here is a sample code snippet on how you can access the customer's information:
Copy code
javascript
define('MyExtension.Profile.Model.Extension', ['Profile.Model'], function(ProfileModel) {
    'use strict';

    _.extend(ProfileModel.prototype, {
        // Override the get function to add your custom field
        get: _.wrap(ProfileModel.prototype.get, function(fn, attr) {
            if (attr === 'customField') {
                return this.attributes.customField;
            }

            return fn.apply(this, _.toArray(arguments).slice(1));
        })
    });
});
In this code snippet, replace
'customField'
with the actual field id that specifies whether the customer is an individual or a company. ****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ******
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.779369473
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.770909965
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.765612
Please provide your feedback on this answer.
a
Could you elaborate on this Profile.Model thing. I couldn't understand how to extend this. Is there any documentation related to this? Currently I am using SCS, is this extend thing work in SCS?
c
Thank you for your feedback
r
The agent isn’t yet programmed to answer follow-up questions in thread. But you can ask again in the main channel.