Category : SuiteScript Functions
Swal.fire is a method from the SweetAlert2 library, which is a popular JavaScript library for creating beautiful, customizable alert boxes. It provides a more attractive and user-friendly alternative to standard JavaScript alert dialogs, allowing developers to create responsive and accessible popups with various options and styles.
.then() or async/await syntax.Swal.fire('Hello World!', 'This is a basic alert.', 'success');
Swal.fire({
2 title: 'Are you sure?',
3 text: 'You won't be able to revert this!',
4 icon: 'warning',
5 showCancelButton: true,
6 confirmButtonText: 'Yes, delete it!',
7 cancelButtonText: 'No, cancel!',
8}).then((result) => {
9 if (result.isConfirmed) {
10 Swal.fire('Deleted!', 'Your file has been deleted.', 'success');
11 } else {
12 Swal.fire('Cancelled', 'Your file is safe :)', 'error');
13 }
14});
Swal.fire is a versatile and powerful method for creating alerts in web applications, providing a modern alternative to traditional JavaScript alerts with extensive customization options and improved user experience.
Tags: