---
title: "au-widget-design-editor/Commands/update-surfaces-command | Customer's Canvas On-Premises"
canonical: "https://customerscanvas.com/docs/on-premises/ui-framework/widgets/reference/au-widget-design-editor.Commands.update-surfaces-command/"
---

# au-widget-design-editor/Commands/update-surfaces-command

> A command that replaces product pages.

## Classes

### UpdateSurfacesCommand

Here, we replace the first page of the loaded product with the third page of a state file.
```json
{
  "type": "design-editor", 
  "name": "editor",
  "params": {
    "initial": { ... }, 
    "updateSurfaces": [{
        "definition": "{{ $['options']._.props.id  }}",
        "surfaces": [0],
        "newProductSurfaces": [2],
        "replaceAll": true
    }]
  }
}
```

#### Extends

- [`DesignEditorWidgetCommand`](https://customerscanvas.com/docs/on-premises/ui-framework/widgets/reference/au-widget-design-editor.Commands.command.md#abstract-designeditorwidgetcommand)

#### Methods

##### execute()

```ts
execute(params): Promise<void>;
```

Executes this command.

###### Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `params` | \| [`IUpdateSurfacesCommandDefinition`](#iupdatesurfacescommanddefinition) \| [`IUpdateSurfacesCommandDefinition`](#iupdatesurfacescommanddefinition)[] | Parameters for the command. |

###### Returns

`Promise`\<`void`\>

###### Overrides

[`DesignEditorWidgetCommand`](https://customerscanvas.com/docs/on-premises/ui-framework/widgets/reference/au-widget-design-editor.Commands.command.md#abstract-designeditorwidgetcommand).[`execute`](https://customerscanvas.com/docs/on-premises/ui-framework/widgets/reference/au-widget-design-editor.Commands.command.md#execute)

## Interfaces

### IUpdateSurfacesCommandDefinition

Replaces a multipage product.

For details, you can refer to the [docs](https://customerscanvas.com/dev/editors/iframe-api/reference/design-editor-iframe/iupdatesurfaceoptionsbydefinition.html).

#### Extends

- `unknown`.[`IDesignEditorCommandDefinition`](https://customerscanvas.com/docs/on-premises/ui-framework/widgets/reference/au-widget-design-editor.IAuWidgetDesignEditor.md#idesigneditorcommanddefinition)

#### Properties

##### after?

```ts
optional after?: string | string[];
```

The next commands to be executed after this command completes.

###### Inherited from

[`IDesignEditorCommandDefinition`](https://customerscanvas.com/docs/on-premises/ui-framework/widgets/reference/au-widget-design-editor.IAuWidgetDesignEditor.md#idesigneditorcommanddefinition).[`after`](https://customerscanvas.com/docs/on-premises/ui-framework/widgets/reference/au-widget-design-editor.IAuWidgetDesignEditor.md#after-1)

##### autoCompile?

```ts
optional autoCompile?: boolean;
```

If `false`, action will never execute automatically.

###### Inherited from

[`IDesignEditorCommandDefinition`](https://customerscanvas.com/docs/on-premises/ui-framework/widgets/reference/au-widget-design-editor.IAuWidgetDesignEditor.md#idesigneditorcommanddefinition).[`autoCompile`](https://customerscanvas.com/docs/on-premises/ui-framework/widgets/reference/au-widget-design-editor.IAuWidgetDesignEditor.md#autocompile-1)

##### executeOnce?

```ts
optional executeOnce?: boolean;
```

If `true`, this command will be executed only once.
You can use it for `initial` command.
For example, we need to change surface depending on the option value.
We write for `initial` and for `updateSurfaces` the same productDefinition with $['option]._
And set `executeOnce = true` for `initial`. And initial will be executed only once.

###### Inherited from

[`IDesignEditorCommandDefinition`](https://customerscanvas.com/docs/on-premises/ui-framework/widgets/reference/au-widget-design-editor.IAuWidgetDesignEditor.md#idesigneditorcommanddefinition).[`executeOnce`](https://customerscanvas.com/docs/on-premises/ui-framework/widgets/reference/au-widget-design-editor.IAuWidgetDesignEditor.md#executeonce-1)

##### executeOnlyAfter?

```ts
optional executeOnlyAfter?: string[];
```

Current command will be executed in a next update only after all commands executed in this param.
The same example from `executeOnce` param.
We need to execute `updateSurface` on all next updates, exclude the first one.
And we set `executeOnlyAfter = ['initial']` for `updateSurface` command.

###### Inherited from

[`IDesignEditorCommandDefinition`](https://customerscanvas.com/docs/on-premises/ui-framework/widgets/reference/au-widget-design-editor.IAuWidgetDesignEditor.md#idesigneditorcommanddefinition).[`executeOnlyAfter`](https://customerscanvas.com/docs/on-premises/ui-framework/widgets/reference/au-widget-design-editor.IAuWidgetDesignEditor.md#executeonlyafter-1)

##### lock?

```ts
optional lock?: string[];
```

Name of widgets that show preloader when command executed.

###### Inherited from

[`IDesignEditorCommandDefinition`](https://customerscanvas.com/docs/on-premises/ui-framework/widgets/reference/au-widget-design-editor.IAuWidgetDesignEditor.md#idesigneditorcommanddefinition).[`lock`](https://customerscanvas.com/docs/on-premises/ui-framework/widgets/reference/au-widget-design-editor.IAuWidgetDesignEditor.md#lock-1)

##### message?

```ts
optional message?: string | string[];
```

The message for preloader.

###### Inherited from

[`IDesignEditorCommandDefinition`](https://customerscanvas.com/docs/on-premises/ui-framework/widgets/reference/au-widget-design-editor.IAuWidgetDesignEditor.md#idesigneditorcommanddefinition).[`message`](https://customerscanvas.com/docs/on-premises/ui-framework/widgets/reference/au-widget-design-editor.IAuWidgetDesignEditor.md#message-1)

##### onExecuted?

```ts
optional onExecuted?: Function | Function[];
```

Functions that executed after command

###### Inherited from

[`IDesignEditorCommandDefinition`](https://customerscanvas.com/docs/on-premises/ui-framework/widgets/reference/au-widget-design-editor.IAuWidgetDesignEditor.md#idesigneditorcommanddefinition).[`onExecuted`](https://customerscanvas.com/docs/on-premises/ui-framework/widgets/reference/au-widget-design-editor.IAuWidgetDesignEditor.md#onexecuted-1)

##### showPreloader?

```ts
optional showPreloader?: boolean;
```

If `true`, displays the preloader while executing this command.

###### Inherited from

[`IDesignEditorCommandDefinition`](https://customerscanvas.com/docs/on-premises/ui-framework/widgets/reference/au-widget-design-editor.IAuWidgetDesignEditor.md#idesigneditorcommanddefinition).[`showPreloader`](https://customerscanvas.com/docs/on-premises/ui-framework/widgets/reference/au-widget-design-editor.IAuWidgetDesignEditor.md#showpreloader-1)

##### timeout?

```ts
optional timeout?: number;
```

The timeout for switching preloader messages.

###### Inherited from

[`IDesignEditorCommandDefinition`](https://customerscanvas.com/docs/on-premises/ui-framework/widgets/reference/au-widget-design-editor.IAuWidgetDesignEditor.md#idesigneditorcommanddefinition).[`timeout`](https://customerscanvas.com/docs/on-premises/ui-framework/widgets/reference/au-widget-design-editor.IAuWidgetDesignEditor.md#timeout-1)
