Morning, How can I get the Items API to include cu...
# suitecommerce
c
Morning, How can I get the Items API to include custom fields added to the Commerce Category? The configuration record only contains the native fields.
s
Er, you can’t? Do you mean how can you fetch custom fields for a category when, for example, you browse to the landing page for the category? Because, for that, you need a code customisation
Something like this:
Copy code
Application.on('after:Category.get', function (CategoryModel, category) {
    var lookupResults = nlapiLookupField('commercecategory', category.internalid, [
        'yourcustomfield'
    ]);
    category.customfield = lookupResults.yourcustomfield
});
But you could just integrate that into your code if you’re using SCA
c
Sorry, I goofed the question. This is the endpoint:
/api/navigation/v1/categorynavitems
. I believe the fields returned are defined in the json config file under Integrations > Categories.
I was hoping to append custom fields defined on the Commerce Category record to the list of available fields.
s
OK, well I’ve never known that to be true, but I don’t actually know enough about how this API works, whether it would accept requests for custom fields. My basic tinkering suggests it doesn’t
c
Thank you for the feedback, @Steve Goldberg. There are many ways to fill this requirement, one of them will work!