Alert in Business rule

Naresh Damji
Tera Expert

Hi All,

I am having issue where i want to throw alert to user in business rule. Currently my business rule is running on sys_attachment table. The condition is like below :

find_real_file.png

The code is like below which checks if the file size is greater than certain limit :

(function executeRule(current, previous /*null when async*/) {

var i = parseInt(current.size_bytes);
gs.addErrorMessage('i is' + i);

if(i > 10)
{

current.setAbortAction(true);
gs.log('-=--------------------------i is' + i);
gs.addInfoMessage("File Size is too large");

}

})(current, previous);

All other script work but none of the gs.addInfoMessage() functions are working. I can able to see the log message and action is getting aborted as per script just needed the alert message throw to user.

I have tired various solution provided in community and forum but none of them worked.

Can someone please help on this case

Regards,

Naresh

1 ACCEPTED SOLUTION

Naresh Damji
Tera Expert

Just to update on this, I have achieved this by adding some code in UI page which helped me to restrict based on image size.

View solution in original post

13 REPLIES 13

Hi,

 

Just take out the line:

 

gs.setRedirect(current);

 

not sure how that krept in.

***If Correct/Helpful please take time mark as Correct/Helpful. It is much appreciated.***

Regards

Paul

Hi Paul,

After taking out that line the alert doesn't even comes in other open tab.

Naresh Damji
Tera Expert

Just to update on this, I have achieved this by adding some code in UI page which helped me to restrict based on image size.

Hi Naresh,

 

Can you please provide more details on how you achieved this?

 

Thank you