How to display a popup after commenting on an incident

Kentaro Numata
Tera Guru

Hello, this is Kentaro.

 

I have a question about the Incident table.

Is it possible to display a pop-up when an agent comments when the status is "Resolved"?

In the popup, I want to ask if I want to change the status back to "in progress."

 

Thanks,

Kentaro.

1 ACCEPTED SOLUTION

Hi, Thank you for replyng!

What should I set for Field name?

It doesn't seem to work unless you set the Field name.

スクリーンショット 2024-07-17 12.18.59.png

 

If I set it to Additional comments, a popup will be displayed when entering a value in the text box.

When I want to execute the Client Script, it is after I press the Post button...

it's difficult...

 

Thanks,

Kentaro.

View solution in original post

3 REPLIES 3

Nguyen Duong1
Tera Contributor

Yeah, you can definitely set up a pop-up for when an agent comments on a resolved incident. Here’s how you can do it with a client script:

  1. Go to System Definition > Client Scripts and make a new Client Script.
  2. Set the Table to Incident and the Type to onChange.
  3. Add a script like this:

if (isLoading || newValue === oldValue) {
return;
}

if (g_form.getValue('state') === 'Resolved' && g_form.getValue('comments')) {
if (confirm("Do you want to change the status back to 'In Progress'?")) {
g_form.setValue('state', 'In Progress');
}
}

 

If the incident's state is "Resolved" and there are new comments, a pop-up will appear asking if you want to change the status back to "In Progress". If confirmed, the state changes to "In Progress".

Hi, Thank you for replyng!

What should I set for Field name?

It doesn't seem to work unless you set the Field name.

スクリーンショット 2024-07-17 12.18.59.png

 

If I set it to Additional comments, a popup will be displayed when entering a value in the text box.

When I want to execute the Client Script, it is after I press the Post button...

it's difficult...

 

Thanks,

Kentaro.

Nguyen Duong1
Tera Contributor

Instead of onChange you may want to use onSubmit, and check if the additional comments has been populated when they submit, though this doesn't work if you want it to be triggered when they post it. Outside of that, you'd have to customize the post button to include the logic, which I probably wouldn't recommend here.