-
Notifications
You must be signed in to change notification settings - Fork 912
Case base64 encode before save / decode on display #1693
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
DhruvBhatheja
wants to merge
7
commits into
ServiceNowDevProgram:main
from
DhruvBhatheja:Case-Base64-Encode-Before-Save-/-Decode-on-Display
Closed
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
a892248
Update script.js
DhruvBhatheja 8950590
Update README.md
DhruvBhatheja 8451bfd
README.md
DhruvBhatheja e452046
Script.js
DhruvBhatheja 27b99f8
Update Script.js
DhruvBhatheja 7dafe7c
Delete Server-Side Components/Background Scripts/inserting a new reco…
DhruvBhatheja 4bb1fb2
Merge branch 'ServiceNowDevProgram:main' into Case-Base64-Encode-Befo…
DhruvBhatheja File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
6 changes: 3 additions & 3 deletions
6
...nts/Background Scripts/inserting a new record into the sys_user table/README.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| # inserting a new record into the sys_user table. | ||
| With this code, we are creating a new GlideRecord object for the 'sys_user' table, initializing it, setting the values for the 'user_name,' 'first_name,' 'last_name,' and 'email' fields, and then inserting a new record into the 'sys_user' table with the specified values. | ||
| In sys_user table a new rcord will be created | ||
| # Create User in ServiceNow (sys_user Table) | ||
| This script is used to create a new record in the sys_user table in ServiceNow. | ||
| It initializes a GlideRecord object, sets the required user details (username, first name, last name, and email), and inserts the record in sys_user table. |
7 changes: 0 additions & 7 deletions
7
...de Components/Background Scripts/inserting a new record into the sys_user table/script.js
This file was deleted.
Oops, something went wrong.
11 changes: 11 additions & 0 deletions
11
...-Side Components/Business Rules/Base64-Encode-Before-Save-And-Display/README.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| Base64 Encode Before Save / Decode on Display | ||
|
|
||
| Explanation: | ||
|
|
||
| Goal: Store sensitive or formatted data (like text) in an encoded format in the database while still allowing users to see and interact with the readable version. | ||
|
|
||
| Before Insert/Update → Encode (secure storage). | ||
|
|
||
| Before Display → Decode (user-friendly display). | ||
|
|
||
| It’s a example of data transformation for secure storage and transparent display. |
25 changes: 25 additions & 0 deletions
25
Server-Side Components/Business Rules/Base64-Encode-Before-Save-And-Display/Script.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| //This is Before Insert/Update Business Rule to automatically store sensitive data in Base64 form. | ||
|
|
||
| (function executeRule(current, previous) { | ||
| if (current.variblename.changes()) { | ||
| var plainText = current.variblename + ''; | ||
| current.variblename = GlideStringUtil.base64Encode(plainText); | ||
| } | ||
| })(current, previous); | ||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
| //this is Display busiess rule to make sure users see the decoded text instead of Base64 | ||
|
|
||
| (function executeRule(current) { | ||
| if (current.variblename) { | ||
| try { | ||
| var decoded = GlideStringUtil.base64Decode(current.variblename); | ||
| current.setDisplayValue('variblename', decoded); | ||
| } catch (ex) { | ||
| current.setDisplayValue('variblename', '[Invalid Base64]'); | ||
| } | ||
| } | ||
| })(current); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your submission. It appears that this pull request contains more files than described in the title. Please review and update the pull request to either remove the extra/unintended files or to update the description to be more comprehensive. Ensure your contributions are meaningful and adhere to the project’s standards. You can create a new branch on your forked repository to avoid accidental inclusions of new commits in the future. Closing this for now. Once you make additional changes, feel free to re-open this Pull Request or create a new one.