From 92b184bc2240bb02afd93d2cadc63930e170cf27 Mon Sep 17 00:00:00 2001 From: Raghav Sharma <53517312+raghavs046@users.noreply.github.com> Date: Fri, 10 Oct 2025 18:26:21 +0530 Subject: [PATCH 1/8] Create test.js --- Specialized Areas/Fix scripts/test.js | 1 + 1 file changed, 1 insertion(+) create mode 100644 Specialized Areas/Fix scripts/test.js diff --git a/Specialized Areas/Fix scripts/test.js b/Specialized Areas/Fix scripts/test.js new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/Specialized Areas/Fix scripts/test.js @@ -0,0 +1 @@ + From f0add90e292d47924110b758d3e0a1c123b4abb5 Mon Sep 17 00:00:00 2001 From: Raghav Sharma <53517312+raghavs046@users.noreply.github.com> Date: Fri, 10 Oct 2025 18:27:02 +0530 Subject: [PATCH 2/8] Delete Specialized Areas/Fix scripts/test.js --- Specialized Areas/Fix scripts/test.js | 1 - 1 file changed, 1 deletion(-) delete mode 100644 Specialized Areas/Fix scripts/test.js diff --git a/Specialized Areas/Fix scripts/test.js b/Specialized Areas/Fix scripts/test.js deleted file mode 100644 index 8b13789179..0000000000 --- a/Specialized Areas/Fix scripts/test.js +++ /dev/null @@ -1 +0,0 @@ - From 4b58955fa19832589435b339653c2aa5de91b2bb Mon Sep 17 00:00:00 2001 From: Raghav Sharma <53517312+raghavs046@users.noreply.github.com> Date: Wed, 15 Oct 2025 21:06:54 +0530 Subject: [PATCH 3/8] Create script.js --- .../Beautify JSON Data in String Fields/script.js | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 Specialized Areas/Beautify JSON Data in String Fields/script.js diff --git a/Specialized Areas/Beautify JSON Data in String Fields/script.js b/Specialized Areas/Beautify JSON Data in String Fields/script.js new file mode 100644 index 0000000000..2c8fa95971 --- /dev/null +++ b/Specialized Areas/Beautify JSON Data in String Fields/script.js @@ -0,0 +1,9 @@ +/* +This script will format the JSON data in string fields on forms. +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. +*/ +var chReq = new GlideRecord('change_request'); // Glide table. +chReqch.get('c83c5e5347c12200e0ef563dbb9a7190'); // sys_id of record, can be replaced with encoded query for multiple records. + +chReq.u_json_field = JSON.stringify(JSON.parse(chReq.u_json_field), null, "\t"); +chReq.update(); From ce42607711f29cd2b31eade2cf4c04f768d92272 Mon Sep 17 00:00:00 2001 From: Raghav Sharma <53517312+raghavs046@users.noreply.github.com> Date: Wed, 15 Oct 2025 21:08:57 +0530 Subject: [PATCH 4/8] Create README.md --- .../Beautify JSON Data in String Fields/README.md | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 Specialized Areas/Beautify JSON Data in String Fields/README.md diff --git a/Specialized Areas/Beautify JSON Data in String Fields/README.md b/Specialized Areas/Beautify JSON Data in String Fields/README.md new file mode 100644 index 0000000000..885552829e --- /dev/null +++ b/Specialized Areas/Beautify JSON Data in String Fields/README.md @@ -0,0 +1,8 @@ +**Details** +1. This script will format the JSON data in string fields on forms. +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. + +**How to use** +1. Run this script as Fix Script. +2. Replace the table name and encoded query as per your requirement. +3. Replace the field to be formatted as per the table selected. From 0391649b2aa094fc36636b44070d3f273d8ba732 Mon Sep 17 00:00:00 2001 From: Raghav Sharma <53517312+raghavs046@users.noreply.github.com> Date: Wed, 15 Oct 2025 21:14:02 +0530 Subject: [PATCH 5/8] Create script.js --- .../Fix scripts/Format JSON in String Fields/script.js | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 Specialized Areas/Fix scripts/Format JSON in String Fields/script.js diff --git a/Specialized Areas/Fix scripts/Format JSON in String Fields/script.js b/Specialized Areas/Fix scripts/Format JSON in String Fields/script.js new file mode 100644 index 0000000000..2c8fa95971 --- /dev/null +++ b/Specialized Areas/Fix scripts/Format JSON in String Fields/script.js @@ -0,0 +1,9 @@ +/* +This script will format the JSON data in string fields on forms. +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. +*/ +var chReq = new GlideRecord('change_request'); // Glide table. +chReqch.get('c83c5e5347c12200e0ef563dbb9a7190'); // sys_id of record, can be replaced with encoded query for multiple records. + +chReq.u_json_field = JSON.stringify(JSON.parse(chReq.u_json_field), null, "\t"); +chReq.update(); From 0e331092e969d3cb28a721ca7dc4e773f0c9c37a Mon Sep 17 00:00:00 2001 From: Raghav Sharma <53517312+raghavs046@users.noreply.github.com> Date: Wed, 15 Oct 2025 21:15:21 +0530 Subject: [PATCH 6/8] Create README.md --- .../Fix scripts/Format JSON in String Fields/README.md | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 Specialized Areas/Fix scripts/Format JSON in String Fields/README.md diff --git a/Specialized Areas/Fix scripts/Format JSON in String Fields/README.md b/Specialized Areas/Fix scripts/Format JSON in String Fields/README.md new file mode 100644 index 0000000000..885552829e --- /dev/null +++ b/Specialized Areas/Fix scripts/Format JSON in String Fields/README.md @@ -0,0 +1,8 @@ +**Details** +1. This script will format the JSON data in string fields on forms. +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. + +**How to use** +1. Run this script as Fix Script. +2. Replace the table name and encoded query as per your requirement. +3. Replace the field to be formatted as per the table selected. From 8d4b36b78c6ccf09b9ae16bc44ae27ba7b0a048c Mon Sep 17 00:00:00 2001 From: Raghav Sharma <53517312+raghavs046@users.noreply.github.com> Date: Wed, 15 Oct 2025 21:15:41 +0530 Subject: [PATCH 7/8] Delete Specialized Areas/Beautify JSON Data in String Fields directory --- .../Beautify JSON Data in String Fields/README.md | 8 -------- .../Beautify JSON Data in String Fields/script.js | 9 --------- 2 files changed, 17 deletions(-) delete mode 100644 Specialized Areas/Beautify JSON Data in String Fields/README.md delete mode 100644 Specialized Areas/Beautify JSON Data in String Fields/script.js diff --git a/Specialized Areas/Beautify JSON Data in String Fields/README.md b/Specialized Areas/Beautify JSON Data in String Fields/README.md deleted file mode 100644 index 885552829e..0000000000 --- a/Specialized Areas/Beautify JSON Data in String Fields/README.md +++ /dev/null @@ -1,8 +0,0 @@ -**Details** -1. This script will format the JSON data in string fields on forms. -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. - -**How to use** -1. Run this script as Fix Script. -2. Replace the table name and encoded query as per your requirement. -3. Replace the field to be formatted as per the table selected. diff --git a/Specialized Areas/Beautify JSON Data in String Fields/script.js b/Specialized Areas/Beautify JSON Data in String Fields/script.js deleted file mode 100644 index 2c8fa95971..0000000000 --- a/Specialized Areas/Beautify JSON Data in String Fields/script.js +++ /dev/null @@ -1,9 +0,0 @@ -/* -This script will format the JSON data in string fields on forms. -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. -*/ -var chReq = new GlideRecord('change_request'); // Glide table. -chReqch.get('c83c5e5347c12200e0ef563dbb9a7190'); // sys_id of record, can be replaced with encoded query for multiple records. - -chReq.u_json_field = JSON.stringify(JSON.parse(chReq.u_json_field), null, "\t"); -chReq.update(); From bed7f3df0a64f8a72e5de8712f9fd656830625f7 Mon Sep 17 00:00:00 2001 From: Raghav Sharma <53517312+raghavs046@users.noreply.github.com> Date: Wed, 15 Oct 2025 21:57:34 +0530 Subject: [PATCH 8/8] Update README.md --- .../Fix scripts/Format JSON in String Fields/README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Specialized Areas/Fix scripts/Format JSON in String Fields/README.md b/Specialized Areas/Fix scripts/Format JSON in String Fields/README.md index 885552829e..3d39e95c3c 100644 --- a/Specialized Areas/Fix scripts/Format JSON in String Fields/README.md +++ b/Specialized Areas/Fix scripts/Format JSON in String Fields/README.md @@ -6,3 +6,11 @@ 1. Run this script as Fix Script. 2. Replace the table name and encoded query as per your requirement. 3. Replace the field to be formatted as per the table selected. + +**Before Formatting** +Before1 + +**After Formatting** + After + +JSON.stringify() documentation : https://www.geeksforgeeks.org/javascript/javascript-json-stringify-method/