- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-28-2024 08:03 PM
I created a Client Script where it should show a confirmation message first before proceeding with changing the active field from True to False.
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.
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.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-29-2024 12:24 AM
@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 !!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-29-2024 02:04 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-29-2024 12:24 AM
@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 !!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-29-2024 02:04 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-29-2024 06:23 AM
@tindiz Great to hear that