Skip to content

Commit 0286266

Browse files
authored
Create script.js
1 parent ba22acd commit 0286266

File tree

1 file changed

+20
-0
lines changed
  • Client-Side Components/Client Scripts/Restrict Fields on Template

1 file changed

+20
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
Type: OnChnage
3+
Table: sys_template
4+
Field: Template
5+
*/
6+
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
7+
if (isLoading || newValue === '') {
8+
return;
9+
}
10+
if (g_form.getValue('table') == 'incident') { // table on which sys_template is being created.
11+
var fields = ['active', 'comments']; // array of fields to be restricted.
12+
for (var i = 0; i < fields.length; i++) {
13+
if (newValue.indexOf(fields[i]) > -1) {
14+
alert("You Cannot Add " + fields[i]); // alert if user selects the restricted field.
15+
var qry = newValue.split(fields[i]);
16+
g_form.setValue('template', qry[0] + 'EQ'); // set the template value to previous values (oldValue does not work in this case).
17+
}
18+
}
19+
}
20+
}

0 commit comments

Comments
 (0)