We're currently using XM Cloud and we have a requirement to migrate media library from Sitecore to AEM (Adobe Experience Manager), so my approach is to leverage Sitecore.Shell.Applications.ContentEditor; and using Sitecore.Web.UI.Sheer. We managed to redirect user to assetpicker from AEM when they clicked on "Browse", but currently the AEM Dam landing is hardcoded and we want to make it dynamic (meaning user should be routed to specific folder based on their site name/property).
I have tried to get the current template path, id (from where the user click on Browse on Content Editor) in Sitecore.Context.Item; but its not helpful
Sitecore.Data.Items.Item myItem = Sitecore.Context.Item;
string language = myItem.Language.Name;
string parentId = myItem.Parent.ID.ToString();
string contextId = myItem.ID.ToString();
This is my function looks like
public override void HandleMessage(Message message)
{
Assert.ArgumentNotNull(message, "message");
Sitecore.Diagnostics.Log.Info("AEM Message","AEMMediaService");
Sitecore.Diagnostics.Log.Info(message["id"],"AEMMediaService");
base.HandleMessage(message);
if (message["id"] != ID)
{
return;
}
switch (message.Name)
{
case "aemimage:add":
Sitecore.Diagnostics.Log.Info("AEMImage Adding", "AEMMediaService");
Sitecore.Data.Items.Item myItem = Sitecore.Context.Item;
string language = myItem.Language.Name;
string parentId = myItem.Parent.ID.ToString();
string contextId = myItem.ID.ToString();
Sitecore.Diagnostics.Log.Info(language,"AEMMediaService");
Sitecore.Diagnostics.Log.Info(parentId,"AEMMediaService");
Sitecore.Diagnostics.Log.Info(contextId,"AEMMediaService");
And this is how I pass the trigger the function and pass ID in the custom image field:
Value: "aemimage:add(id=$Target)"
Would love to receive any advice to help me solve this. Thank you so much