Dear All, can anyone tell me how to get the custom...
# suitecommerce
n
Dear All, can anyone tell me how to get the custom category field to the frontend category template?
s
In a SuiteScript file you need something like this:
Copy code
Application.on('after:Category.get', function (CategoryModel, category) {
    var lookupResults = nlapiLookupField('commercecategory', category.internalid, [
        'yourcustomfield'
    ]);
    category.customfield = lookupResults.yourcustomfield
});
n
Thanks @Steve Goldberg will try
@Steve Goldberg the above code is not working. i found that categories are loading by API call not by suitescript model. any thoughts on this?
s
I mean, I haven't tried it myself. It was my notepad from years ago - we could have changed the code since I wrote it
n
Yes, is there any other way to get field data to frontend?
s
Write a separate SuiteScript service to fetch it
n
i can, but how that would be rendered in the existing category navigation
actually i want to display custom display name instead of the category name in the navigation.
s
OK, well I'm starting to think you would need to rewrite those modules in SCA
n
but customer is using SCS
s
sadblob
n
may be this can be potential to add in next release