I want to add the custom metadata field in asset during asset creation. I have the referred the documentation for the asset class and asset manager class. I have used the createAsset function to create the asset.
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dam="http://www.day.com/dam/1.0" xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:mix="http://www.jcp.org/jcr/mix/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
jcr:mixinTypes="[mix:referenceable]"
jcr:primaryType="dam:Asset"
jcr:uuid="11111111111111111111111">
<jcr:content
dam:relativePath="demo/demo"
jcr:lastModified="{Date}2016-10-12T21:13:27.224+05:30"
jcr:lastModifiedBy="dam-replication-service"
jcr:primaryType="dam:AssetContent">
<metadata
dam:extracted="{Date}2016-10-12T21:13:27.164+05:30"
dam:sha1="17cb9a4ba368ff01951a11c3ca7e3f8348eee59c"
dam:size="{Long}1184"
dc:format="application/demo"
jcr:mixinTypes="[cq:Taggable]"
jcr:primaryType="nt:unstructured"/>
<related jcr:primaryType="nt:unstructured"/>
</jcr:content>
</jcr:root>
This is a demo code. I want add an additional property in metadata say: source="xyz". I have also referred this link Adding additional Metadata field in AEM-DAM. Can some one please help me. Thanks in advance.
Not exactly clear what issue you have in adding additional metadata field. There are couple of ways to do this -
/etc/workflow/models/dam/update_asset.html
or write an event listener (process intensive as it will get called multiple times when asset is imported and processed via workflows) which listens to Asset changes and adds the metadata field