Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Asset versioning - who created latest asset version and when ?

Avatar

Employee

We have a requirement to see who uploaded the asset's most recent asset version on author and when ? Is there any way to show those details to business users on publish site ?

1 Accepted Solution

Avatar

Correct answer by
Level 3

Hi,

 

One way to implement this to use custom metadata properties to hold this information. This can be updated as part of the publish workflow for asset or using ResourceChangeListeners.

 

Thanks

Narendra

View solution in original post

5 Replies

Avatar

Community Advisor

Hi @digarg,

I believe OOTB AEM versioning and timeline functionality is what you are looking for.

Below you can find link to short video that explains, how and when version is created, and what information for each version is exposed to the user.

Here is also sample screenshot the is presenting what you can expect

asset-versions.jpg

Avatar

Employee

Thanks @lukasz-m  for response. Sorry if I missed the details  - Not really, I need this info on the publisher (ASC reference site) on asset detail page to show to end users.

Avatar

Community Advisor

Hi @digarg,

Sorry I did not catch the information about publish. Anyway below you can find quite detailed description how you can achieve your goal.

Assumptions

  • versions are created on author only, so information related to each version is not available on publish. However we have information when and who did last changes against specific asset - this is base for version. This is represented by jcr:lastModified and jcr:lastModifiedBy properties stored under jcr:content node of each asset. In other words you are always publish latest version, so jcr:lastModified and jcr:lastModifiedBy will be relevant for latest version. Even if you revert to older version you will always have data for this specific one.
  • after doing any change version is created automatically
  • information from jcr:lastModified and jcr:lastModifiedBy are transferred to publish during OOTB publication process - so they are available on publish and can be presented to the page visitor
  • solution will use elements/apis provided by ACS - to reduce custom development, and complication in future
  • all steps has been described base on demo structure provided by ACS

Solution

I have divided proposed solution into 2 sections, first should allow to achieve main goal, second is optional however will increase end user experience.

Mandatory part

Below steps should be repeated on each asset details page (OOTB there are dedicated pages for images, video, document, presentation - the main difference is set of metadata that could be characteristic for specific asset type) which should contains information about author and date.

  1. Edit image asset details page - /content/asset-share-commons/en/light/details/image.html
  2. Add new Metadata component and edit it. Set Label value and Matadata Type
    metadata.png
  3. Add another metadata component and edit it. Set Label value and Matadata Type, Format for Date Configuration
    metadata-2.png
  4. Open crx/de and navigate to /content/asset-share-commons/en/light/details/image/jcr:content/root/rail/responsivegrid
    1. Find component added in step 4 (you can recognize it via label value you have set), and add propertyName with value ./jcr:content/jcr:lastModifiedBy. Remember to save changes.
      crx-1.jpg
    2. Find component added in step 4 (you can recognize it via label value you have set), and add propertyName with value ./jcr:content/jcr:lastModified. Remember to save changes.
      crx-2.jpg
  5. Go back to /content/asset-share-commons/en/light/details/image.html and publish changes.
  6. You should see below result on publish server
    details-page-publish.jpg
  7. Repeat steps 1-5 for all other details pages.

One last comment, why some changes have been done via crx/de. In general not all properties are available from Property Name drop-down. Nevertheless setting it from crx/de will do the job.

Optional

As you can see user name taken from ./jcr:content/jcr:lastModifiedBy is presented as user id. For better experience you can create new Computed property that will be able to display proper first and last name base on user ID - or any other presentation for that will be needed. If you would like to show more details about authors you have to make sure that those data has been published. Custom Computed property requires some development. Here are some links:

Avatar

Level 4

jcr:lastModified and jcr:lastModifiedBy  won't work and isn't reliable. When someone updates metadata info , both above properties get updated as below and hence this doesn't truly reflects who created version or when was last version created.Screenshot 2022-07-12 at 11.02.06 PM.png

Avatar

Correct answer by
Level 3

Hi,

 

One way to implement this to use custom metadata properties to hold this information. This can be updated as part of the publish workflow for asset or using ResourceChangeListeners.

 

Thanks

Narendra