- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi Team,
i want to auto pop new value and old value when user change state from list view, i have written below script. but it is showing only new value, old value showing like undefined.
please give solution if anyone know.
client script - Oncell Edit
field - state
function onCellEdit(sysIDs, table, oldValues, newValue, callback) {
var stateMap = {
"1": "New",
"2": "In Progress",
"3": "On Hold",
"6": "Resolved",
"7": "Closed"
};
var oldValue = oldValues[sysIDs[0]];
var oldDisplay = stateMap[oldValue] || oldValue;
var newDisplay = stateMap[newValue] || newValue;
var message = "You are changing State\n\n" +
"Old Value: " + oldDisplay + "\n" +
"New Value: " + newDisplay + "\n\n" +
"Do you want to proceed?";
if (confirm(message)) {
callback(true);
} else {
callback(false);
}
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @mchandra
Replace var oldValue = oldValues[sysIDs[0]]; with var oldValue = oldValues[0]; , it works like a butter 🙂
function onCellEdit(sysIDs, table, oldValues, newValue, callback) {
//Type appropriate comment here, and begin script below
var saveAndClose = true;
alert(sysIDs)
var stateMap = {
"1": "New",
"2": "In Progress",
"3": "On Hold",
"6": "Resolved",
"7": "Closed"
};
var oldValue = oldValues[0]; // fix this
var oldDisplay = stateMap[oldValue] || oldValue;
var newDisplay = stateMap[newValue] || newValue;
var message = "You are changing State\n\n" +
"Old Value: " + oldDisplay + "\n" +
"New Value: " + newDisplay + "\n\n" +
"Do you want to proceed?";
if (confirm(message)) {
saveAndClose = true;
} else {
saveAndClose = false;
}
callback(saveAndClose);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @mchandra
Replace var oldValue = oldValues[sysIDs[0]]; with var oldValue = oldValues[0]; , it works like a butter 🙂
function onCellEdit(sysIDs, table, oldValues, newValue, callback) {
//Type appropriate comment here, and begin script below
var saveAndClose = true;
alert(sysIDs)
var stateMap = {
"1": "New",
"2": "In Progress",
"3": "On Hold",
"6": "Resolved",
"7": "Closed"
};
var oldValue = oldValues[0]; // fix this
var oldDisplay = stateMap[oldValue] || oldValue;
var newDisplay = stateMap[newValue] || newValue;
var message = "You are changing State\n\n" +
"Old Value: " + oldDisplay + "\n" +
"New Value: " + newDisplay + "\n\n" +
"Do you want to proceed?";
if (confirm(message)) {
saveAndClose = true;
} else {
saveAndClose = false;
}
callback(saveAndClose);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Thanks @Laveena-Agarwal its working!!!!!
