Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to Remove or Customize "Are you sure you want to end the conversation?" Pop-up in Virtual Agent

Violetta
Tera Contributor

Hello colleagues,

I'm working on a customization for the Virtual Agent on the Service Portal, and I need your help.

When a user clicks the X button in the upper right corner of the Virtual Agent chat window, a confirmation pop-up appears with the message:

"Are you sure you want to end the current conversation?"

We would like to remove the pop-up, so that the chat simply closes without requiring confirmation.

I’ve checked the documentation and explored options such as:

  • UI Messages
  • System Properties
  • Virtual Agent Widget configuration

However, I wasn’t able to find anything directly related to this specific pop-up.

I raised this with ServiceNow Support, and they confirmed that there’s no out-of-the-box setting to disable or configure this dialog and customization is required to change or remove the pop-up.

 

Has anyone implemented such a customization?
Any guidance or code snippets would be greatly appreciated!

Thanks in advance!

3 REPLIES 3

Prasanna_Patil
Tera Guru
Tera Guru

Hi @Violetta 

 

I think you need to customize it...

 

Go to widget and clone the widget. And then try replacing the client script with the below code

 

$scope.confirmClose = function () {

    $scope.closeChat();

};

Please hit like and Mark Helpful if you liked it
Regards,
Prasanna

Search for virtual widget

Please hit like and Mark Helpful if you liked it
Regards,
Prasanna

Shubham_Jain
Mega Sage
Mega Sage

@Violetta 

 

You can modify your existing script with below piece of code: 

 

// Directly close the chat without confirmation
closeChatWindow(); // or whatever the internal method is

 

Instead of below: 

 

if (confirm("Are you sure you want to end the current conversation?")) {
// close logic
}

✔️ If this solves your issue, please mark it as Correct.


✔️ If you found it helpful, please mark it as Helpful.



Shubham Jain