updateContent

Updates the title and contentBody of the content item in the content editor of an enhanced CMS workspace. Updates are persisted when the user clicks Save in the content editor.

You can use this.context.data.schema.schema.properties to return the list of contentBody property fields for the content type.

Syntax 

1import { LightningElement, wire } from 'lwc';
2import { updateContent }  from experience/cmsEditorApi;
3class Example extends LightningElement{
4  // change the content in the editor
5  updateContent({
6    "title": "new title",
7    "contentBody: {
8      "name": "New name",
9      "description": "New description",
10      "excerpt": "new-excerpt"
11    }
12  }).then(() => {
13      //handle success
14  })
15}

Parameters 

Parameter NameTypeDescriptionRequired?
contentBodyObjectThe JSON representation of the content body, which varies depending on the content type. See JSON File Format for Content in Salesforce CMS in Salesforce Help.Yes
titleStringThe new title of the content item in the editor.Yes

Returns 

  • A Promise object that resolves when the updateContent response is returned.
  • error—A validation error for invalid fields.