CMS Page
CMS page enables you to create different pages for hosting content on your website. For more information, see Pages.
For help working with this record in the UI, see CMS Page Type Record.
The internal ID for this record is cmspage
.
See the SuiteScript Records Browser for all internal IDs associated with this record.
For information about using the SuiteScript Records Browser, see Working with the SuiteScript Records Browser in the NetSuite Help Center.
For information about scripting with this record in SuiteScript, see the following:
Supported Script Types
The CMS page record is scriptable in server SuiteScript only.
Supported Functions
The CMS page record is partially scriptable. It can be created, updated, and searched using SuiteScript. It cannot be copied, attached, or transformed.
Usage Notes
You must enable the Site Management Tools feature on the Web Presence subtab at Setup > Company > Enable Features to be able to script with this record.
Script Samples
Create CMS Page Record
The following sample code snippet creates a basic landing page record (pagetype =1) for the specified SCA site.
var recordObj = record.create({
type: record.Type.CMS_PAGE,
isDynamic: false
});
recordObj.setValue({
fieldId: 'name',
value: 'Cms Page Name'
});
recordObj.setValue({
fieldId: 'site',
value: 1
});
recordObj.setValue(
fieldId: 'pagetype',
value: 1
});
recordObj.setValue({
fieldId: 'cmspagetype',
value: 1
});
recordObj.setValue({
fieldId: 'url',
value: 'PageUrl'
});
return = recordObj.save({
enableSourcing: false,
ignoreMandatoryFields: false
});
Search CMS Page Records
The following sample code snippet searches for all CMS page records for a given SCA site. It returns the name, site, pagetype, and url fields as search result columns.
function searchCmsPageRecords(siteId){
var searchColumns = search.create({
type: search.Type.CMS_PAGE,
columns: [{
name: 'name'
}, {
name: 'site'
}, {
name: 'pagetype'
}, {
name: 'url'
}],
filters: [{
name: 'site',
operator: search.Operator.IS,
values: 1 // example siteId
}]
});
searchColumns.run().each(function(result){
var name = result.getValue({
name: 'name'
});
var site = result.getValue({
name: 'site'
});
var pageType = result.getValue({
name: 'pagetype'
});
var url = result.getValue({
name: 'url'
});
return true;
});
}