Expand my Community achievements bar.

SOLVED

Auto-populate asset metadata schema

Avatar

Level 4

I've created an asset metadata schema and it contains a date field named "Publication Date". The requirement is that when I apply the schema to asset folder, it should update the date field to current date. Also, there's another date field i.e. Date Modified which should be filled with the date on which asset is renamed. I have gone through this documentation as well https://helpx.adobe.com/experience-manager/6-2/assets/using/metadata-schemas.html Is there any OOTB way to achieve it? If not, what should be the custom approach I should apply? or a custom java script had to be written ? we are using AEM 6.2. Thanks in Advance

1 Accepted Solution

Avatar

Correct answer by
Level 4

-> it should update the date field to current date.

Do you mean asset's metadata should update "Publication Date" as when this schema got applied to parent folder. I am not sure if I have understood use case mentioned here, but this can be achieved using Processing Profile[1]. 

Once you get the "Publication Date" field auto populated (through [1]) on asset's metadata, then it should be mapped in metadata schema.

Out of Two metadata fields (type Date) which needs to be displayed at metadata editor, one will display "Publication Date" and other display asset modified (renamed is one of the operation which updates modified time).

You can simply drag 2 dates fields using predicate list and edit the default form or create custom form and apply to specific folder.

[0]Metadata Schemas

[1] Processing Profiles

View solution in original post

8 Replies

Avatar

Correct answer by
Level 4

-> it should update the date field to current date.

Do you mean asset's metadata should update "Publication Date" as when this schema got applied to parent folder. I am not sure if I have understood use case mentioned here, but this can be achieved using Processing Profile[1]. 

Once you get the "Publication Date" field auto populated (through [1]) on asset's metadata, then it should be mapped in metadata schema.

Out of Two metadata fields (type Date) which needs to be displayed at metadata editor, one will display "Publication Date" and other display asset modified (renamed is one of the operation which updates modified time).

You can simply drag 2 dates fields using predicate list and edit the default form or create custom form and apply to specific folder.

[0]Metadata Schemas

[1] Processing Profiles

Avatar

Level 4

Thanks for the response. I've gone through it but I don't think this way I can achieve what I'm trying to do. I've created a custom metadata schema and have added 2 custom properties: 1. Publication Date(dam:publicationDate) 2. Replication Date(dam:replicationDate) Now, when I apply this metadata schema over assets, I can see those 2 fields in asset metadata but it doesn't have any value; these fields are empty. As per the requirement when I need is, when I apply metadata schema over assets, these 2 fields should have values auto-populated i.e. when I see asset metadata, these 2 fields should have value. So, here what I'm looking for if there's any way I can auto-populate these 2 fields value in asset metadata while applying metadata schema?

Avatar

Level 4

Yes that is expected. Asset's metadata doesn't have any value and that was the first point in my previous reply "how asset is going to get the values".

Applying Metadata Schema AA to Folder BB means, assets under the folder BB would use this schema AA when open through metadata editor. The values on assets under BB can be set using metadata editor.

For auto population of metadata values on assets under BB can be achieved through Processing Profile (different feature).

You have to use both Processing Profile & Metadata Schema feature here to auto-populate and display metadata respectively. Here are   the documentation of both the features.

->when I apply this metadata schema over assets

Also Metadata Schema can't be applied on assets, it is applicable only for folders.

[0]Metadata Schemas

[1] Processing Profiles

Avatar

Level 4

Hi Ashu, Thanks for more clarification and now I understood this part. But, I've 1 more question: Using the processing profile, we can assign default value to fields as shown in official documentation. But, is there a way to assign dynamic default value instead of configuring the static values which gets applied. Like, for publication date I want to have dynamic value populated when the asset was last replicated! Is there any way achieve it? Regards, Vijay

Avatar

Level 4

When asset gets replicated, the replication status properties[0] are already set on Asset's metadata by the platform and same (precisely cq:lastReplicated ) should be used. No need to use Processing Profile for this use case, you are right it is only applicable to static values (like Tags, Description etc.)

[0] Custom Node Types

Avatar

Level 4

If I use cq:lastReplicated for the publication date, this will get updated on both publish and un-publish. so it doesn't serve the right time stamp. Is there way to make blank dynamically when unpublished ? If you have any other approach please do suggest. thanks, Vijay

Avatar

Level 4

Make use of cq:lastReplicationAction Property. You can use Cascading Metadata OOTB[0] in 6.4 to set the visibility rule dynamically (i.e. when cq:lastReplicationAction=Activate). For previous releases, customize the same visibility rule using custom validator.

Thanks

[0]Adobe Experience Manager Help | Using Cascading Metadata in AEM Assets