File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed
Client-Side Components/Client Scripts/Detect oldValue newValue and Operation in Glide List Type Fields Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change 1+ In Client Scripts, oldValue will display the value of last value/record which is stored in that field.
2+ For new records, it is generally empty and for existing records it displays the value which is stored after load.
3+ If we will try to change the value in that field, it will still show oldValue the same value which was there during the load of form.
4+
5+ So, In order to identify the oldValue on change(as it does in business rule(previous)), This script comes handy and also it will
6+ detect the action performed.
7+
8+
9+ This onChange Client script comes handy when dealing with Glide List type fields where we have to change the value
10+ in that particular field and detect the value before and after change and also detect the operation which was
11+ performed(addition or removal).
12+
13+ Setup details:
14+
15+ onChange client Script on [ incident] table
16+ Field Name: [ watch_list]
17+ Script: Check [ detectOldValuenewValueOperation.js] file
18+
19+
20+ Output:
21+
22+ Currently there is no one in the watchlist field:
23+
24+ <img width =" 784 " height =" 232 " alt =" image " src =" https://github.com/user-attachments/assets/245339ac-04b3-47db-922a-912cca32fba5 " />
25+
26+ Adding [ amos.linnan] , It shows the operation was addition, newValue(user's sysId) as well as oldValue(empty)
27+ <img width =" 751 " height =" 387 " alt =" image " src =" https://github.com/user-attachments/assets/e6a5d255-44bc-45a1-950b-fd3cb4599f26 " />
28+
29+
30+ Adding 2 users one by one:
31+
32+ <img width =" 1903 " height =" 353 " alt =" image " src =" https://github.com/user-attachments/assets/512e77ed-9116-4027-8fd2-446654ef3891 " />
33+
34+
35+ Removing 2 at once:
36+
37+ <img width =" 1684 " height =" 375 " alt =" image " src =" https://github.com/user-attachments/assets/54c233de-62af-4e9e-948f-f23e55a155e5 " />
You can’t perform that action at this time.
0 commit comments