How many times did you write the code to find the previous value on a specific field? Long time ago I found a library called “HistoryWalker” and since then its been on my must-have snippets on my utils. This library sn_hw is not “public” available but you can see lot of scripts using it. Quite useful 🙂
getHistoryWalker: function(grObject,field) {
var answer = [];
var previousValue;
var hw = new sn_hw.HistoryWalker(grObject.getRecordClassName(), grObject.getUniqueValue());
hw.walkTo(grObject.sys_mod_count);
do {
var wr = hw.getWalkedRecordCopy();
var currentValue = wr.getValue(field);
if (currentValue != previousValue) {
previousValue = currentValue;
answer.push(wr.getValue(field) + '');
}
} while (hw.walkBackward());
return answer;
},

