Alert with ok and cancel option using window function

Instead of a standard alert in client script, we can use window.confirm to get OK and Cancel options in the alert.

  let waiveShipping = currentRecord.getValue({ fieldId:fieldid})

                    let options = “Are you sure you want to waive shipping? Please enter the reason.”;

                    if (waiveShipping) {

                       //It works when clicks ok in the alert

                        if (window.confirm(options)) {

                            return true;

                        }

                        else {

//it works when cancel clicks in the alert

                          currentRecord.setValue({

                                fieldId: fieldid,

                                value: false

                            });

                            return true;

                        }

                    }

Leave a comment

Your email address will not be published. Required fields are marked *