File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed
Specialized Areas/Fix scripts/Format JSON in String Fields Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change 1+ ** Details**
2+ 1 . This script will format the JSON data in string fields on forms.
3+ 2 . There is on OOB attribute "json_view" which can be added to field but it always reqires an extra click and has loading time issues.
4+
5+ ** How to use**
6+ 1 . Run this script as Fix Script.
7+ 2 . Replace the table name and encoded query as per your requirement.
8+ 3 . Replace the field to be formatted as per the table selected.
9+
10+ ** Before Formatting**
11+ <img width =" 956 " height =" 371 " alt =" Before1 " src =" https://github.com/user-attachments/assets/1b35dfaf-d2ad-44c3-bbd2-d3198664073b " />
12+
13+ ** After Formatting**
14+ <img width =" 950 " height =" 382 " alt =" After " src =" https://github.com/user-attachments/assets/c3a1c3c0-48bd-4d2f-9e27-fea0ed86004d " />
15+
16+ JSON.stringify() documentation : https://www.geeksforgeeks.org/javascript/javascript-json-stringify-method/
Original file line number Diff line number Diff line change 1+ /*
2+ This script will format the JSON data in string fields on forms.
3+ There is on OOB attribute "json_view" which can be added to field but it always reqires an extra click and has loading time issues.
4+ */
5+ var chReq = new GlideRecord ( 'change_request' ) ; // Glide table.
6+ chReqch . get ( 'c83c5e5347c12200e0ef563dbb9a7190' ) ; // sys_id of record, can be replaced with encoded query for multiple records.
7+
8+ chReq . u_json_field = JSON . stringify ( JSON . parse ( chReq . u_json_field ) , null , "\t" ) ;
9+ chReq . update ( ) ;
You can’t perform that action at this time.
0 commit comments