1. Tasks
  2. Upsert Email Layout

Tasks

Upsert Email Layout

Creates or updates an email layout in the stub's org.

Leave out layoutuuid to create a new layout. Pass the layoutuuid of an existing layout to edit it.

Layouts created with this task also show up in the Editor.

Basic usage

loading...

Parameters

layoutuuid
string

The layoutuuid of the layout to edit.

Required when editing a layout. Leave it out to create a new layout. A new layoutuuid is then generated and returned in the result.


descname
string

The descriptive name of the layout, as shown in the Editor.

Required when creating a layout. Optional when editing.


mjml
string

The layout markup, written in MJML. This is what is used when an email is sent.

The markup must contain a {{{message}}} part. This is where Stubber injects the email message.

Task params are substituted before the task runs, which would remove the {{{message}}} part. To prevent this:

  • Wrap markup written directly in the task in {{{{skip}}}}...{{{{/skip}}}}, as in the basic usage example.
  • Pass markup stored on the stub with ~~ notation, e.g. "~~stub.data.layout_mjml". Don't use {{stub.data.layout_mjml}}, as it HTML-escapes the markup.

Required when creating a layout. Optional when editing.

The markup is saved to the layout's draft version. Templates running on the draft branch use the draft straight away. Templates running on the live branch only use it once it is published. See publish.


publish
optional
boolean

Publishes the layout's draft version, so that templates running on the live branch also use it. This is the same as publishing the layout from the Editor.

Can be used on its own to publish a layout that has already been saved.

Default: false


active
optional
boolean

Marks the layout as active or inactive.

When creating a layout and active is left out, it defaults to true. When editing a layout and active is left out, it is left unchanged.

Default: true


grapejs
optional
object

The Editor's design data for the layout.

This is not required. It has no effect on the emails that are sent, only mjml does. Only set it if you want the layout to be editable in the Editor's visual designer.

If you change mjml without also setting matching grapejs, editing and saving the layout in the Editor afterwards will replace your mjml with markup generated from the Editor's design.


parent_drivefileuuid
optional
string

The folder in the Editor to place a new layout in.

Only used when creating a layout. Leave it out to place the layout at the top level.

Result

loading...

Properties

layoutuuid
string

The layoutuuid of the created or edited layout. Use this in the custom_email_settings.format.layoutuuid parameter of an email notification.


created
boolean

true if a new layout was created, false if an existing layout was edited.


details
object

The layout's details after the update.


details.descname
string

The descriptive name of the layout.


details.active
boolean

Whether the layout is marked as active.


details.archived
boolean

Whether the layout is archived in the Editor.

Examples

Create and publish a layout

loading...

Update an existing layout's markup

The change is saved to the draft version only. Templates running on the live branch keep using the published version until the layout is published.

loading...

Deactivate a layout

loading...

Publish a layout

loading...