Confirmation message is not working/appearing

tindiz
Giga Guru

I created a Client Script where it should show a confirmation message first before proceeding with changing the active field from True to False.

 

tindiz_0-1727578726775.png

 

I added an alert to check if the script is executing properly because the confirmation message is not appearing.

Every time I change the active field from Tue to False, that alert is appearing but after clicking OK the confirmation message does not pop-up and it wouldn't let me proceed with changing the value on the active field from True to False.

tindiz_1-1727578886020.png

 

I checked everything, this is the only Client Script under customer_contact table with the type of onCellEdit.

The user that I am impersonating has the proper role.

I checked the pop-up blocker and it is allowed.

I am not sure why the confirmation message is not appearing. Please help.

 

 

2 ACCEPTED SOLUTIONS

SANDEEP28
Mega Sage

@tindiz You are doing two mistakes

1) Parameter provided in onCellEdit function are wrong. Remove everything from you script section ang put below code. 

function onCellEdit(sysIDs, table, oldValues, newValue, callback) {
    var saveAndClose = false;

    callback(saveAndClose);
}

2) You are using GlideForm API (g_form) which is not supported onCellEdit client script.

 

Here is your Final code. It will work. Make sure "sn_customerservice_manager" role name is correct. 

 

function onCellEdit(sysIDs, table, oldValues, newValue, callback) {
    var saveAndClose = false;
    //Type appropriate comment here, and begin script below
    if ((newValue == false || newValue == 'false') && g_user.hasRole('sn_customerservice_manager')) {
        var confrimation = confirm('Are you sure you want to deactivate this user? This action cannot be undone')
        if (confrimation)
            saveAndClose = true;
    }

    callback(saveAndClose);
}

 

If I could help you with your Query then, please hit the Thumb Icon and mark as Correct !!

 

 

 

 

 

 

 

View solution in original post

@SANDEEP28 it works! Thank you so much!!!!!!!!!!!!!!!!!!!

View solution in original post

7 REPLIES 7

SANDEEP28
Mega Sage

@tindiz You are doing two mistakes

1) Parameter provided in onCellEdit function are wrong. Remove everything from you script section ang put below code. 

function onCellEdit(sysIDs, table, oldValues, newValue, callback) {
    var saveAndClose = false;

    callback(saveAndClose);
}

2) You are using GlideForm API (g_form) which is not supported onCellEdit client script.

 

Here is your Final code. It will work. Make sure "sn_customerservice_manager" role name is correct. 

 

function onCellEdit(sysIDs, table, oldValues, newValue, callback) {
    var saveAndClose = false;
    //Type appropriate comment here, and begin script below
    if ((newValue == false || newValue == 'false') && g_user.hasRole('sn_customerservice_manager')) {
        var confrimation = confirm('Are you sure you want to deactivate this user? This action cannot be undone')
        if (confrimation)
            saveAndClose = true;
    }

    callback(saveAndClose);
}

 

If I could help you with your Query then, please hit the Thumb Icon and mark as Correct !!

 

 

 

 

 

 

 

@SANDEEP28 it works! Thank you so much!!!!!!!!!!!!!!!!!!!

@tindiz  Great to hear that