replaceBlock

Replaces the selected component on the canvas of a marketing content item. Updates persist when the user saves their changes in the content builder. Use this function when building a CMS extension for Marketing Cloud Next that interacts with components on the canvas.

Parameter NameTypeDescriptionRequired?
selectedBlockObjectThe new component that replaces the selected component on the canvas.Yes
nodeIdStringThe ID of the selected component (or node) to be replaced. This field must be included in an object as the second parameter.Yes
  • A Promise object that resolves when the replaceBlock action has been initiated. The replacement operation is asynchronous in the content builder.
  • error—A validation error indicating that the nodeId was invalid or not provided, or that the block is invalid.