How to create alert in with Ok and cancel button in client script

if (scriptContext.fieldId == 'custbody_jj_wave_delivery_fee') {

                        let deliveryWaiver = currentRecord.getValue({
                            fieldId: 'custbody_jj_wave_delivery_fee'
                        });
                        if (deliveryWaiver) {
                            let options = "Are you sure you want to waive delivery fee? Please enter the reason.";
                            currentRecord.getField({
                                fieldId: 'custbody_jj_deli_fee_reason'
                            }).isMandatory = true
                            if (window.confirm(options)) {
                                return true;
                            }
                            else {
                                currentRecord.getField({
                                    fieldId: 'custbody_jj_deli_fee_reason'
                                }).isMandatory = false
                                currentRecord.setValue({
                                    fieldId: 'custbody_jj_wave_delivery_fee',
                                    value: false
                                })
                                return true;
                            }
                        }
                        else {
                            currentRecord.getField({
                                fieldId: 'custbody_jj_deli_fee_reason'
                            }).isMandatory = false
                            return true;
                        }
                    }
                    else return true;

Leave a comment

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