How to prevent sending of email notification

ceraulo
Mega Guru

Hello!

We have a notification that is triggered when Additional comments changes. We have a new requirement to only send this type of notification when State is New/In Progress/On Hold. This works when the state is in New/In Progress/On Hold. It also sends the notification when there is an additional comment and the user clicks the Resolve button.

Is there a way to not send the notification when the State changes to Resolved and there is an additional comment?

Please help.

Thank you.

1 ACCEPTED SOLUTION

Riya Verma
Kilo Sage
Kilo Sage

Hi @ceraulo ,

 

Hope you are doing great.

To restrict the  notification when the state changes to resolved, follow below steps:

  1. Find the Business rule which is responsible for sending the notification when the "Additional comments" field changes.
  2. Enhance script logic to restrict the notification when state is resolved and additional comments is changed, referencing below script:
var currentState = current.state;
var additionalComments = current.additional_comments;

// Check if the state is in the allowed values (New, In Progress, or On Hold)
if (currentState == 'New' || currentState == 'In Progress' || currentState == 'On Hold') {
    // Check if the state is Resolved and there are additional comments
    if (!(currentState == 'Resolved' && additionalComments)) {
        // Send the notification
        gs.eventQueue('notification.send', current, 'additional_comments');
    }
}

Please mark the appropriate response as correct answer and helpful, This may help other community users to follow correct solution.
Regards,
Riya Verma

View solution in original post

1 REPLY 1

Riya Verma
Kilo Sage
Kilo Sage

Hi @ceraulo ,

 

Hope you are doing great.

To restrict the  notification when the state changes to resolved, follow below steps:

  1. Find the Business rule which is responsible for sending the notification when the "Additional comments" field changes.
  2. Enhance script logic to restrict the notification when state is resolved and additional comments is changed, referencing below script:
var currentState = current.state;
var additionalComments = current.additional_comments;

// Check if the state is in the allowed values (New, In Progress, or On Hold)
if (currentState == 'New' || currentState == 'In Progress' || currentState == 'On Hold') {
    // Check if the state is Resolved and there are additional comments
    if (!(currentState == 'Resolved' && additionalComments)) {
        // Send the notification
        gs.eventQueue('notification.send', current, 'additional_comments');
    }
}

Please mark the appropriate response as correct answer and helpful, This may help other community users to follow correct solution.
Regards,
Riya Verma