-
Notifications
You must be signed in to change notification settings - Fork 0
/
StandardFieldAttributes.txt
95 lines (72 loc) · 4.04 KB
/
StandardFieldAttributes.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
Follow these steps only if URL contains ".salesforce.com/_ui/common/config/field/StandardFieldAttributes/e"
Step 1 : Run the below code
/* Copy from this line */
var fls = "";
flsStorageFieldLevel = "SALESFORCE#COPY#FLS#HOST:"+window.location.hostname+"#FieldName:";
var query = window.location.search.substring(1);
var vars = query.split("&");
for (var i=0;i<vars.length;i++) {
var pair = vars[i].split("=");
if(pair[0] == 'id') {
flsStorageFieldLevel += pair[1];
}
if(pair[0] == 'type') {
flsStorageFieldLevel += '#ObjectType:'+pair[1];
}
}
var thisIsANotRequiredField = false;
var elem = document.getElementsByTagName("tr");
for (var i = 0; i < elem.length; i++) {
for (var j = 0; j < elem[i].childNodes.length; j++) {
if (elem[i].childNodes[j].nodeName == "TD" && elem[i].childNodes[j].firstChild.nodeName == 'INPUT' && elem[i].childNodes[j].firstChild.type == 'checkbox') {
if(elem[i].childNodes[j].firstChild.checked == true) {
var prof = elem[i].childNodes[j].firstChild.title.split(", ")[0];
var acc = elem[i].childNodes[j].firstChild.title.split(", ")[1];
//console.log(prof+" : "+acc);
fls += prof+"="+acc+";";
if(!flsStorageFieldLevel.includes("<"+prof+">=R") && acc == "Read-Only") {
flsStorageFieldLevel += "<"+prof+">=R;";
} else {
flsStorageFieldLevel += "<"+prof+">=V;";
}
/*if(localStorage.getItem(prof) != "R" && acc == "Read-Only") {
localStorage.setItem(prof, 'R');
} else {
localStorage.setItem(prof, 'V');
}*/
//var checkTD = elem[i].childNodes[j].firstChild.checked = true;
} else if(elem[i].childNodes[j].firstChild.checked == false) {
thisIsANotRequiredField = true;
}
//console.log(elem[i].childNodes[j].firstChild.title.split(",")[1]);
}
}
}
console.log(flsStorageFieldLevel);
/* Copy until this line */
Step 2: the above will print some output, copy that and paste in the below code:
/*Copy from this line*/
var flsStorageFieldLevel = '*****PASTE HERE THE OUTPUT FROM STEP 1******';
var elem = document.getElementsByTagName("tr");
for (var i = 0; i < elem.length; i++) {
for (var j = 0; j < elem[i].childNodes.length; j++) {
if (elem[i].childNodes[j].nodeName == "TD" && elem[i].childNodes[j].firstChild.nodeName == 'INPUT' && elem[i].childNodes[j].firstChild.type == 'checkbox') {
if(flsStorageFieldLevel == 'no fls') {
elem[i].childNodes[j].firstChild.checked = false;
} else {
var prof = elem[i].childNodes[j].firstChild.title.split(", ")[0];
var acc = elem[i].childNodes[j].firstChild.title.split(", ")[1];
if(flsStorageFieldLevel.includes("<"+prof+">=R") && (acc == 'Visible' || acc == 'Read-Only')) {
elem[i].childNodes[j].firstChild.checked = true;
elem[i].childNodes[j].firstChild.style.outline = '2px solid #3330e5';
} else if(flsStorageFieldLevel.includes("<"+prof+">=V") && acc == 'Visible') {
elem[i].childNodes[j].firstChild.checked = true;
elem[i].childNodes[j].firstChild.style.outline = '2px solid #3330e5';
} else {
elem[i].childNodes[j].firstChild.checked = false;
}
}
}
}
}
/*Copy until this line*/