Developing a CCT Extension. A reference for myself.
Every time I need to create a CCT (Custom Content Type) extension I have to find my scribbled notes and cross reference them to the NetSuite documentation. This post will fix that problem.
Here are the steps:
- Create the baseline extension: ‘gulp extension:create’ (note: add ‘_base’ to the name to differentiate it later.
- Add CCT extension module as separate module: ‘gulp extension:create-cct’ (note: add ‘CCT’ to the end of the name to differentiate.
- Modify ‘mountToApp’ method in base extension to include ‘cms.registerContentType()’ method
- Modify the base view in the same file as step 3 to use the view for the CCT module
- Create custom record to hold the CCT settings and match the record id ‘customrecord_xxxxxxxxx’ to the ‘settings_record’ value in the ‘cct’ section of the manifest.json
- Create the custom content type and point it to the custom record in step 5. Also, the custom record NAME field needs to match the ‘registercct_id’ value in the ‘cct’ section of the manifest.json
It’s a fairly straightforward process. The devil is in the details, as usual. I’ve included enough of the big picture so that anyone familiar with the extension development process and SuiteCommerce should be able to follow along. If you created extensions already then most of this should be familiar. In short, you’re creating two extensions and linking them together. The second extension gets bootstrapped in the ‘mountToApp’ method of the first extension. The ‘manifest.json’ needs to know the names of your custom record and your custom content type record. If you miss any of the parts, your extension will be greyed out in the website’s CMS tools page.