Skip to content

Commit 27b99f8

Browse files
Update Script.js
1 parent e452046 commit 27b99f8

File tree

1 file changed

+7
-7
lines changed
  • Server-Side Components/Business Rules/Base64-Encode-Before-Save-And-Display

1 file changed

+7
-7
lines changed
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
//This is Before Insert/Update Business Rule to automatically store sensitive data in Base64 form.
22

33
(function executeRule(current, previous) {
4-
if (current.u_field1.changes()) {
5-
var plainText = current.u_field1 + '';
6-
current.u_field1 = GlideStringUtil.base64Encode(plainText);
4+
if (current.variblename.changes()) {
5+
var plainText = current.variblename + '';
6+
current.variblename = GlideStringUtil.base64Encode(plainText);
77
}
88
})(current, previous);
99

@@ -14,12 +14,12 @@
1414
//this is Display busiess rule to make sure users see the decoded text instead of Base64
1515

1616
(function executeRule(current) {
17-
if (current.u_field1) {
17+
if (current.variblename) {
1818
try {
19-
var decoded = GlideStringUtil.base64Decode(current.u_field1);
20-
current.setDisplayValue('u_field1', decoded);
19+
var decoded = GlideStringUtil.base64Decode(current.variblename);
20+
current.setDisplayValue('variblename', decoded);
2121
} catch (ex) {
22-
current.setDisplayValue('u_field1', '[Invalid Base64]');
22+
current.setDisplayValue('variblename', '[Invalid Base64]');
2323
}
2424
}
2525
})(current);

0 commit comments

Comments
 (0)