Skip to content

Commit 0391649

Browse files
authored
Create script.js
1 parent ce42607 commit 0391649

File tree

1 file changed

+9
-0
lines changed
  • Specialized Areas/Fix scripts/Format JSON in String Fields

1 file changed

+9
-0
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
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();

0 commit comments

Comments
 (0)