Expand my Community achievements bar.

SOLVED

Display Error Message to User via Workflow

Avatar

Level 4

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.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

@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

View solution in original post

4 Replies

Avatar

Correct answer by
Community Advisor

@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

Avatar

Level 4

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.

Avatar

Community Advisor

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-ass... 

This would help to show error on UI. 

Avatar

Level 4

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)?