Display Error Message to User via Workflow | Community
Skip to main content
May 17, 2023
Solved

Display Error Message to User via Workflow

  • May 17, 2023
  • 2 replies
  • 2073 views

Hello,

Using workflows, is it possible to display an informative error message (such as a dialog) if certain conditions are met? My use case is that we are wanting to restrict upload to the DAM for select users and folders. I figured a Workflow would probably be the most efficient way to accomplish this. However, I am struggling to find a good way to return a message to a user indicating that the upload failed due to file size restrictions. I thought about using a "Participant Step", but I would prefer something more immediately obvious in the UI, such as a popup dialog. Is this possible?

 

We are using AEM 6.5.10.

 

Thanks.

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

@kmarchewa 

 

When you upload or drop an asset in one of the DAM folder, immediately DAM Update Asset workflow triggers on the asset being uploaded and executes several steps like creating renditions, metadata extraction and others. 

You can edit the DAM Update Asset workflow and add a custom process step after the Start step in the model to run the checks and terminate the workflow, but this would not give an interactive pop-up for User. 

 

To notify user through an interactive pop-up, I see the following as an potential option:

  1. When user drops/uploads an asset, there is a POST call with AEM Servlet (In AEM cloud service SDK, the end-point is - /content/dam/<folder-path>.initiateUpload.json, Servlet is InitiateUploadAssetServlet). There would be something similar in AEM 6.5.10 version, please check. 
  2. Write a Sling Filter to intercept the asset upload end-point requests, where you can run the checks on the request and return the error message without adding the asset to DAM.

I hope this helps. 

 

Thanks

Lokesh

2 replies

Lokesh_Vajrala
Community Advisor
Lokesh_VajralaCommunity AdvisorAccepted solution
Community Advisor
May 18, 2023

@kmarchewa 

 

When you upload or drop an asset in one of the DAM folder, immediately DAM Update Asset workflow triggers on the asset being uploaded and executes several steps like creating renditions, metadata extraction and others. 

You can edit the DAM Update Asset workflow and add a custom process step after the Start step in the model to run the checks and terminate the workflow, but this would not give an interactive pop-up for User. 

 

To notify user through an interactive pop-up, I see the following as an potential option:

  1. When user drops/uploads an asset, there is a POST call with AEM Servlet (In AEM cloud service SDK, the end-point is - /content/dam/<folder-path>.initiateUpload.json, Servlet is InitiateUploadAssetServlet). There would be something similar in AEM 6.5.10 version, please check. 
  2. Write a Sling Filter to intercept the asset upload end-point requests, where you can run the checks on the request and return the error message without adding the asset to DAM.

I hope this helps. 

 

Thanks

Lokesh

KMarchewaAuthor
May 19, 2023

Thanks, that was very helpful. I will have to more research on the specifics for my version of AEM, but sounds like a very robust solution.

Community Advisor
May 18, 2023

Hi @kmarchewa , If you want to show an error pop up to the user on upload you may want to check this out https://experience-aem.blogspot.com/2021/05/aem-cloud-service-configure-file-upload-max-size-per-asset-type-restrict-upload-ui.html 

This would help to show error on UI. 

KMarchewaAuthor
May 19, 2023

Thanks! That article was very helpful. Do you know if there is an efficient way to get the current user's role in the clientlib ("/apps/eaem-cs-restrict-assets-size/supported-file-sizes" in the example)?