Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

BR to display alert on case

Jason116
Tera Contributor

Can some please help me write a BR so that an alert (pop up message) is displayed when ever an update is made to a case from a specific contact, I hav tried the following but it's not working?

 

(function executeRule(current, previous /*null when async*/) {
    // Check if the contact is Test
    if (current.contact == 'Test') {
        // Display pop-up message
        var alertMessage = 'A new update has been made to the case.';
        var script = "alert('" + alertMessage + "');";
        gs.getSession().getClient().runScript(script);
    }
})(current, previous);
2 REPLIES 2

Sandeep Rajput
Tera Patron
Tera Patron

@Jason116 alert is a client side script function and a business rule is a server side script. You will not be able to call a client side method from server side. Instead you need to use gs.addInfoMessage() or gs.addErrorMessage() to show message to the user.

 

Here is the updated script.

 

(function executeRule(current, previous /*null when async*/) {
    // Check if the contact is Test
    if (current.contact == 'Test') {
        // Display pop-up message
        var alertMessage = 'A new update has been made to the case.';
        gs.addInfoMessage(alertMessage);
    }
})(current, previous);

 

Thanks, i need this to display as an alert though i.e. i need a window to pop up with the message and the user to click 'ok ' to acknowledge it, how can i do this? if this needs to be another script i.e client script how would this look?