Expand my Community achievements bar.

SOLVED

How to programmatically relate/unrelate an asset to another asset or content fragment?

Avatar

Adobe Champion

Hi,

 

Does someone have any sample code on how we can programmatically  relate/unrelate an asset to another asset or content fragment?

 

Basically looking for the highlighted OOB functionality that can be done programmatically instead of manual. I have a process to create QR code using Content fragment. So looking on options to relate them somehow, so that users can navigate to the right CF's which created it, by a link on it.

P_V_Nair_0-1692825111075.png

P_V_Nair_1-1692825225243.png

 

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

@P_V_Nair I think the AssetRelation API should be the one that you are looking for. 

 

https://javadoc.io/static/com.adobe.aem/uber-jar/6.2.SP1-CFP15/com/adobe/granite/asset/api/Asset.htm...

You have an option to relate and unrelate assets using this one.

View solution in original post

1 Reply

Avatar

Correct answer by
Community Advisor

@P_V_Nair I think the AssetRelation API should be the one that you are looking for. 

 

https://javadoc.io/static/com.adobe.aem/uber-jar/6.2.SP1-CFP15/com/adobe/granite/asset/api/Asset.htm...

You have an option to relate and unrelate assets using this one.