File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
Server-Side Components/Business Rules/Use_case_Base64-Encode-Before-Save-And-Decode-on-Display Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change 1+ // Decode on Display Trigger: Before Display
2+ ////Decodes fieldName from Base64. Shows decoded value on the form.
3+
4+ ( function executeRule ( current ) {
5+ if ( current . fieldName ) { // field name can be anything
6+ try {
7+ var decoded = GlideStringUtil . base64Decode ( current . fieldName ) ;
8+ current . setDisplayValue ( 'fieldName' , decoded ) ;
9+ } catch ( ex ) {
10+ current . setDisplayValue ( 'fieldName' , '[Invalid Base64]' ) ;
11+ }
12+ }
13+ } ) ( current ) ;
14+
15+ //If the field is new or updated, encodes its value to Base64. Saves the encoded string to the database.
16+
17+ // For Example User enters Hello World in fieldName.
18+ //Before saving : System encodes and stores SGVsbG8gV29ybGQ= in the database.
19+ //When the record is viewed : Display rule decodes it back to Hello World for the user.
You can’t perform that action at this time.
0 commit comments