Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session
SOLVED

Can we create a content fragment and have it automatically published in the publish environment?

Avatar

Level 3

Good afternoon, I have the following question:

 

We are creating content fragments from the Author Assets API, but we do not know how we can publish it as soon as we create it, since the checks we do are in the "Publish" environment, therefore, we cannot validate that Content Fragment without first publish it manually.

 

The question is... Is there any way to publish it automatically?

 

Thank you so much.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

hi @Alex_Terinte ,

In AEM, when creating Content Fragment

using the Author Assets API, you can set the workflow model to automatically publish the Content Fragment upon creation. This way, you can ensure that the Content Fragment is published without manual intervention.

Here are the steps to configure automatic publishing of Content Fragments:

  1. Create a custom workflow model:

    • In the AEM author instance, navigate to Tools -> Workflow -> Models.
    • Create a new workflow model or modify an existing one.
    • Configure the workflow steps to include the necessary validations and actions for your Content Fragments.
    • Add the "Publish" step at the end of the workflow model to trigger automatic publishing.
    • Save and activate the workflow model.
  2. Invoke the workflow model during Content Fragment creation:

    • Use the Author Assets API to create the Content Fragment programmatically.
    • Before saving the Content Fragment, associate it with the configured workflow model by setting the appropriate workflow metadata.
    • Ensure that the workflow model you created in step 1 is used for the Content Fragment.

View solution in original post

3 Replies

Avatar

Community Advisor

Hi @Alex_Terinte 
It is possible using Workflow Launcher or Writing custom Event Lister to replicate on create event.



Arun Patidar

Avatar

Correct answer by
Community Advisor

hi @Alex_Terinte ,

In AEM, when creating Content Fragment

using the Author Assets API, you can set the workflow model to automatically publish the Content Fragment upon creation. This way, you can ensure that the Content Fragment is published without manual intervention.

Here are the steps to configure automatic publishing of Content Fragments:

  1. Create a custom workflow model:

    • In the AEM author instance, navigate to Tools -> Workflow -> Models.
    • Create a new workflow model or modify an existing one.
    • Configure the workflow steps to include the necessary validations and actions for your Content Fragments.
    • Add the "Publish" step at the end of the workflow model to trigger automatic publishing.
    • Save and activate the workflow model.
  2. Invoke the workflow model during Content Fragment creation:

    • Use the Author Assets API to create the Content Fragment programmatically.
    • Before saving the Content Fragment, associate it with the configured workflow model by setting the appropriate workflow metadata.
    • Ensure that the workflow model you created in step 1 is used for the Content Fragment.