Skip to content

Commit be7adb4

Browse files
authored
Create code.js
1 parent 303a732 commit be7adb4

File tree

1 file changed

+24
-0
lines changed
  • GlideRecord/Track any update on record

1 file changed

+24
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
(function executeRule(current, previous /*null when async*/) {
2+
3+
// Add your code here
4+
for (var x in current){
5+
if(x!='comments'&&x!='sys_mod_count'&&x!='sys_updated_by'&&x!='sys_updated_on'){
6+
if (current[x] != previous[x]) {
7+
var currVal=current[x].getDisplayValue();
8+
if(current[x].getDisplayValue()==''){
9+
currVal='empty';
10+
}
11+
if(x=='description'){
12+
current.comments=current[x].getLabel() +' has been updated to ' +currVal;
13+
}
14+
else{
15+
var prev=previous[x].getDisplayValue();
16+
if(previous[x].getDisplayValue()==''){
17+
prev='empty';
18+
}
19+
current.comments=current[x].getLabel() +' has been updated to ' +currVal+' from '+prev;
20+
}
21+
}
22+
}
23+
}
24+
})(current, previous);

0 commit comments

Comments
 (0)