While uploading an Asset, can we parse the filename, add some parts of it as metadata? | Community
Skip to main content
October 2, 2018

While uploading an Asset, can we parse the filename, add some parts of it as metadata?

  • October 2, 2018
  • 2 replies
  • 8739 views

Some assets being uploaded to AEM have a pre-defined naming convention, like name-number-size.jpg. While uploading the Asset is there anyway to read this file name, parse the..

1. name applied to title

2. number applied to another custom metadata field already defined on the schema?

We were thinking that the only option we have is to add an extra step to "Dam Update Asset" workflow.

There is a "Text Extraction" step but does not have many option to do any customization here..

AEM Version: AEM 6.3 SP2

Appreciate any advice.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

2 replies

raj_mandalapu
Level 7
October 2, 2018

I don't think any other way available here,  we need to add an extra workflow step to extract data and store into the repository, using metadata schema mapping you can map with respective fields.

I am not sure, but you can just check is there any possibility with JS, but it is not recommended because the repository contains the full name of the file but metadata contains different data name -> title and number -> number field

I feel the effort which you are going to put for other approaches is higher than the straightforward workflow approach.

smacdonald2008
Level 10
October 2, 2018

Write a Sling Servlet that uses the AssetMamager and upload the Asset by using the Sling Servlet. You can code the servlet to meet your needs.

smacdonald2008
Level 10
October 2, 2018

Or you can - use you mentioned - write a custom AEM Workflow Step to modify the Asset.

raj_mandalapu
Level 7
October 8, 2018

You need to create a new process step and add that into DAM Update Asset workflow, to create a workflow Process you can refer below article

Adobe Experience Manager Help | Creating custom AEM workflow steps that send email messages

  • Inside the execute method read file from the payload
  • Using split function get the name and number.
  • Create a new property and add it to the image node
  • Finally using the metadata schema map the respective filelds