How to display a message to user from rule?

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Established Member II

How to display a message to user from rule?

Hello

Is there a way to show a user the output of the rule?

Let's say the rule checks content data on file upload and deletes it when it doesn't meet the criteria. How to inform the user that his file was deleted because of the  <custom rule's message>?

 

I know I can easily show popup by executing Alfresco.util.PopupManager.displayPrompt() but rules run on server-side Javascript which doesn't have this functionality. 

5 Replies
Highlighted
Community Manager
Community Manager

Re: How to display a message to user from rule?

Hi @upforsin 

I don't believe this is possible, because as you say, rules run on the server side, can run asyncronously, and have no return type, while Share runs client side - there seems to be no mechanism for reporting results between them Smiley Sad.

HTH

Digital Community Manager, Alfresco Software.
Problem solved? Click Accept as Solution!
Highlighted
Established Member II

Re: How to display a message to user from rule?

Hi @EddieMay 

I cannot do it directly but what if i.e. the rule would call a Share webscript which would then display a popup? Just loud thinking Smiley Tongue

Highlighted
Community Manager
Community Manager

Re: How to display a message to user from rule?

Hi @upforsin 

I don't know is the honest answer. However, how would you know that the rule had completed if there is no return value & if the rule is run asyncronously?

Cheers,

Digital Community Manager, Alfresco Software.
Problem solved? Click Accept as Solution!
Highlighted
Alfresco Employee

Re: How to display a message to user from rule?

Share Web Scripts can't show pop ups, they are also server side code.

Software Engineer in Alfresco Search Team.
Highlighted
Established Member II

Re: How to display a message to user from rule?

The rule might be implemented in Java, so before the function's end it should send the message to the frontend, like: "Hey Share, let's display a popup now". 

I was counting on Share webscripts but @angelborroy proved me wrong.

For now, I am just throwing an AlfrescoRuntime exception with my custom message. It works but it doesn't seem like an elegant solution. I'll update this post when I figure something out. Thanks for the help @EddieMay @angelborroy .

 

Anyway, sending a message from backend to frontend.. it feels to me like it should be a basic task