cs-icon.svg

Contentstack Management - Variants Actions

Variants are the different variations of an entry displayed to different audiences created within a Personalize project.

The Contentstack Management Variant Actions lets you update, publish, and fetch the details of all the variants in a Variant Group.

Note: You can create an Entry Variant for Variant Groups via Automate or the CMS. However, audiences for Experiences can be created only via the Contentstack Personalize platform.

image1.jpg

Let’s look at each of them in detail.

Get All Variants of a Content Type

This action fetches the details of all the variants for the selected content type.

  1. Under Choose an Action tab, select the Get All Variants of a Content Type action.
  2. On the Get All Variants of a Content Type Configure Action page, enter the details given below:
    1. Click + Add New Account button to connect your Contentstack account as shown in the Connect your Contentstack Account to Automate step.
    2. Select a Stack and Content Type from the Lookup list.
      image1.jpg
  3. Once done, click Proceed.
  4. Click Test Action to test the configured action.
    Test_Action
  5. On successful configuration, you can see the below output. Click Save and Exit.

    image3.jpg

Get All Variants of an Entry

This action fetches the details of all the variants of a specific entry for the selected content type.

  1. Under Choose an Action tab, select the Get All Variants of an Entry action.
  2. On the Get All Variants of an Entry Configure Action page, enter the details given below:
    1. Click + Add New Account button to connect your Contentstack account as shown in the Connect your Contentstack Account to Automate step.
    2. Select a Stack, Content Type, and Entry from the Lookup list.Select_Fields.png
  3. Once done, click Proceed.
  4. Click Test Action to test the configured action.
    Test_Action
  5. On successful configuration, you can see the below output. Click Save and Exit.Save_Exit.png

Get a Single Variant

This action fetches the details of a single variant from a selected Variant Group.

  1. Under Choose an Action tab, select the Get a Single Variant action.
  2. On the Get a Single Variant Configure Action page, enter the details given below:
    1. Click + Add New Account button to connect your Contentstack account as shown in the Connect your Contentstack Account to Automate step.
    2. Select a Stack, Variant Group, and Variant from the Lookup list.Select_Fields.png
  3. Once done, click Proceed.
  4. Click Test Action to test the configured action.
    Test_Action.png
  5. The output will be shown as follows. Click the Save and Exit button.Save_Exit.png

Publish Variant(s) of an Entry

This action publishes the entry’s existing variant(s).

  1. Under Choose an Action tab, select the Publish Variant(s) of an Entry action.
  2. On the Publish Variant(s) of an Entry Configure Action page, enter the details given below:
    1. Click + Add New Account button to connect your Contentstack account as shown in the Connect your Contentstack Account to Automate step.
    2. Select a Stack, Branch, Content Type, Entry, Variant Group, and Variant(s) from the Lookup list.
      Select_Fields.png
    3. Select the Locale(s) and Environment(s) to publish the entry’s variant. You can select multiple locales and environments.Select_Locale_Environment.png
    4. Optionally, enable the Show Optional Fields toggle button to schedule the publishing activity. You can mark the checkboxes for Nested reference publishing, Publish latest base variant, Publish latest base conditionally.

      Additional Resource: Refer to the Publish an Entry Variant document to learn more.

      Show_Optional_Fields.png
  3. Once done, click Proceed.
  4. Click Test Action to test the configured action.
    Test_Action.png
  5. The output will be shown as follows. Click the Save and Exit button.
    Save_Exit.png

Update a Variant of an Entry

This action updates the content of an entry’s existing variant in the Variant Group.

  1. Under Choose an Action tab, select the Update a Variant of an Entry action.
  2. On the Update a Variant of an Entry Configure Action page, enter the details given below:
    1. Click + Add New Account button to connect your Contentstack account as shown in the Connect your Contentstack Account to Automate step.
    2. Select a Stack, Content Type, Entry, Variant Group, and Variant from the Lookup list. Select_Fields.png
    3. Enter the Entry Data to update the variant in JSON format.Entry_Field.png

      Sample JSON:

      {
        "entry": {
          "title": "Sample Title Updated",
          "name": "Jane Doe",
          "group": {
            "multi_line": "This is the updated multi-line field content."
          },
          "global_field": {
            "single_line": "This is the updated single-line field content."
          }
        }
      } 
      
  3. Once done, click Proceed.
  4. Click Test Action to test the configured action.
    Test_Action.png
  5. The output will be shown as follows. Click the Save and Exit button.Save_Exit.png
Was this article helpful?
^