Simple Pop up on click of UI Action

Kumar38
Kilo Sage

I created a delete button that deletes related records. The script is working fine.

 

I would like to display a simple pop up that asks confirmation for deleting records .

 

This UI Action client marked as false

3 REPLIES 3

Amit Gujarathi
Giga Sage
Giga Sage

HI @Kumar38 ,
I trust you are doing fine.

  1. Navigate to the UI Action record in ServiceNow.
  2. Set the 'Client' field to false.
  3. In the 'Script' field, add the following code:
function deleteRecords() {
  if (confirm("Are you sure you want to delete the records?")) {
    // Perform the deletion logic here
    // ...
    // ...
  }
}

deleteRecords();

Was this answer helpful?


Please consider marking it correct or helpful.


Your feedback helps us improve!


Thank you!


Regards,


Amit Gujrathi



Ankur Bawiskar
Tera Patron
Tera Patron

@Kumar38 

If it's not client side then you cannot show alert

Make it both client + server and use confirm box or alert box and then use gsftSubmit to pass to server side for deletion

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@Kumar38 

Hope you are doing good.

Did my reply answer your question?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader