Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Version increment on Asset and Page

Avatar

Level 1

Hi,  

 

I need help with version on Assets.

 

When asset or page are saved it creates a new version with incremental value as 1.0, 1.1, 1.2 and so on. Which is in 1.x.  Does version ever change from  1.x to 2.x or it there a way to change the version in this format.

Please find attached screen shot for reference.

Vickysingh-Thakur_0-1600236975505.png

 

Thanks in advance. 

 

1 Accepted Solution

Avatar

Correct answer by
Level 8

As per adobe documentation, the default behaviour is 

  • Create versions of any page.
  • The initial labels and version node names will be 1.0, 1.1, 1.2 and so forth.
  • Restore the first version; i.e. 1.0.
  • Create new versions again.
  • The generated labels and node names will now be 1.0.0, 1.0.1, 1.0.2, etc.

Refer: https://docs.adobe.com/content/help/en/experience-manager-64/authoring/siteandpage/working-with-page...

But, if you want to implement custom numbering, instead of 1.0 if you want 2.0 then the below approach may help you.

Create a new workflow step, in the workflow step, write custom replication code, while replicating it should also create a version.

The ReplicationOptions class has setRevision method, you can try that.

https://helpx.adobe.com/experience-manager/6-3/sites/developing/using/reference-materials/javadoc/co...

 

 

ReplicationOptions options = new ReplicationOptions();
    // Do not create new versions as this adds to overhead
    options.setSuppressVersions(true);
    // Avoid sling job overhead by forcing synchronous. Note this will result in serial activation.
    options.setSynchronous(true);
    // Do NOT suppress status update of resource (set replication properties accordingly)
    options.setSuppressStatusUpdate(false);  
 
    log.info("**** ABOUT TO REPLICATE" ) ;  
    //Rep the content      replicate(Session session, ReplicationActionType type, String path)
    replicator.replicate(session,ReplicationActionType.ACTIVATE,path);

 

You can refer this to get some idea.

https://helpx.adobe.com/experience-manager/using/aem64_replication_api.html

You need to disable the activation step which is in the request for activation workflow and author your custom activation step.

 

 

 

 

 

View solution in original post

1 Reply

Avatar

Correct answer by
Level 8

As per adobe documentation, the default behaviour is 

  • Create versions of any page.
  • The initial labels and version node names will be 1.0, 1.1, 1.2 and so forth.
  • Restore the first version; i.e. 1.0.
  • Create new versions again.
  • The generated labels and node names will now be 1.0.0, 1.0.1, 1.0.2, etc.

Refer: https://docs.adobe.com/content/help/en/experience-manager-64/authoring/siteandpage/working-with-page...

But, if you want to implement custom numbering, instead of 1.0 if you want 2.0 then the below approach may help you.

Create a new workflow step, in the workflow step, write custom replication code, while replicating it should also create a version.

The ReplicationOptions class has setRevision method, you can try that.

https://helpx.adobe.com/experience-manager/6-3/sites/developing/using/reference-materials/javadoc/co...

 

 

ReplicationOptions options = new ReplicationOptions();
    // Do not create new versions as this adds to overhead
    options.setSuppressVersions(true);
    // Avoid sling job overhead by forcing synchronous. Note this will result in serial activation.
    options.setSynchronous(true);
    // Do NOT suppress status update of resource (set replication properties accordingly)
    options.setSuppressStatusUpdate(false);  
 
    log.info("**** ABOUT TO REPLICATE" ) ;  
    //Rep the content      replicate(Session session, ReplicationActionType type, String path)
    replicator.replicate(session,ReplicationActionType.ACTIVATE,path);

 

You can refer this to get some idea.

https://helpx.adobe.com/experience-manager/using/aem64_replication_api.html

You need to disable the activation step which is in the request for activation workflow and author your custom activation step.