Author API Methods
setSection()
Controls the creation or modification of a section within the Activity currently being edited.
You would want to use this method so that you can programmatically add a new section or update an existing section in an Activity.
Important If you provide a label that matches an existing section, that section is overwritten; otherwise, a new section is created.
Examples
// Add or update a section in the Activity
var setSectionReturnValue = authorApp.setSection({
label: "New Section", // Section label; overwrites if it already exists
items: [{
reference: "item-reference-1", // Reference to an existing Item
organisation_id: 1 // Itembank associated with the Item
}]
});
console.log(setSectionReturnValue);
Arguments
-
activitySection object
Defines the section to be added or modified. If you do not provide this argument, a new section is created with an automatically generated label and no Items.
Return value
Type boolean
Returns true if the section is successfully added or updated.
Returns false if unable to set the section, for example, if you are not in the Activity editor view or the provided activitySection object is invalid.
Type definitions
-
activitySection object
Defines the structure of an Activity section.
The following properties are supported.
-
label string
Specifies the section label. If not provided, a label is automatically generated. If the label matches an existing section, that section is overwritten.
-
items array[ItemObject]
An array of ItemObject references to be used in the section. If this argument is not passed, an empty items array will be created for the section.
See ItemObject in the
itemsInitialization article for property definitions.
-
Versioning
Version added: v2026.2.LTS (now live in developer)