Leverage expression fragments use-expression-fragments

When using the personalization editor, you can leverage all the expression fragments that have been created or saved to the current sandbox.

A fragment is a reusable component that can be referenced across Journey Optimizer campaigns and journeys. This functionality allows to prebuild multiple custom content blocks that can be used by marketing users to quickly assemble contents in an improved design process. Learn how to create and manage fragments.

➡️ Learn how to manage, author and use fragments in this video

Use an expression fragment use-expression-fragment

To add expression fragments to your content, follow the steps below.

NOTE
You can add up to 30 fragments in a given delivery. Fragments can only be nested up to 1 level.
  1. Open the personalization editor and select the Fragments button on the left pane.

    The list displays all the expression fragments that have been created or saved as fragments on the current sandbox. They are sorted by creation date: recently added expression fragments are shown first in the list. Learn more

    You can also refresh this list.

    note note
    NOTE
    If some fragments were modified or added while you are editing your content, the list will be updated with the latest changes.
  2. Click the + icon next to an expression fragment to insert the corresponding fragment ID into the editor.

    note caution
    CAUTION
    You can add any Draft or Live fragment to your content. However, you won’t be able to activate your journey or campaign if a fragment with the Draft status is being used in it. At journey or campaign publication, draft fragments will show an error and you’ll need to approve them to be able to publish.
  3. Once the fragment ID has been added, if you open the corresponding expression fragment and edit it from the interface, the changes are synchronized. They are automatically propagated to all draft or live journeys/campaigns containing that fragment ID.

  4. Click the More actions button next to a fragment. From the contextual menu that opens, select View fragment to get more information about that fragment. The Fragment ID is also displayed and can be copied from here.

  5. You can open the expression fragment in another window to edit its content and properties - either using the Open fragment option in the contextual menu or from the Fragment info pane. Learn how to edit a fragment

  6. You can then customize and validate your content as usual using all the personalization and authoring capabilities of the personalization editor.

NOTE
If you create an expression fragment that contains multiple line breaks and use it in SMS or push content, the line breaks are preserved. Thus make sure to test your SMS or push messsage before sending it.

Customize editable fields customize-fields

If certain portions of an expression fragment have been made editable using variables, you can override their default values using a specific syntax. Learn how to make your fragments customizable

To customize the fields, follow these steps:

  1. Insert the fragment into your code from the Fragments menu.

  2. Use the <fieldId>="<value>" code at the end of the syntax to override the default value of the variable.

    In the example below, we are overriding the value of a variable whose ID is “sports” with the “yoga” value. This will display “yoga” in your fragment content everywhere the “sport” variable is referenced.

An example showing how to add editable fields into an expression fragments and override their values when creating an email is available in this section.

Break inheritance break-inheritance

When adding a fragment ID to the personalization editor, the changes made to the original expression fragment are synchronized.

However, you can also paste the content of an expression fragment into the editor. From the contextual menu, select Paste fragment to insert that content.

In that case, the inheritance from the original fragment is broken. The content of the fragment is copied into the editor, and the changes are not synchronized anymore.

It becomes a standalone element that is no longer linked to the original fragment; you can edit it as any other element in your code.

recommendation-more-help
b22c9c5d-9208-48f4-b874-1cefb8df4d76