Skip to content

Commit 041d1cc

Browse files
authored
Use case of addOption() and removeOption() in onChange client script for priority field (#986)
* Create script.js addOption() and removeOption() in onChange client script for priority field * Create readme.md
1 parent 986ee44 commit 041d1cc

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# onChange client script for table 'change_request' where field is 'priority'
2+
if priority is critical, impact can be high and medium i.e, low will be removed from choice list using removeOption()
3+
and for other priority ,impact can be high, medium and low i.e, low option will be added, using addOption()
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
2+
if (isLoading || newValue === '') {
3+
return;
4+
}
5+
if(newValue == 1) {
6+
g_form.removeOption('impact',3); // 3 is the value for impact 'low'
7+
} else {
8+
g_form.addOption('impact',3,'3 - Low');
9+
}
10+
}

0 commit comments

Comments
 (0)