File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
Client-Side Components/Client Scripts/Hide Dependent Choice field if there no dependent choices Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change 1+ var NumberOfDependentChoices = Class . create ( ) ;
2+ NumberOfDependentChoices . prototype = Object . extendsObject ( AbstractAjaxProcessor , {
3+ getCountOfDependentChoices : function ( ) {
4+ var dependentChoiceCount = 0 ;
5+ var choiceName = this . getParameter ( 'sysparm_choiceName' ) ;
6+ var tableName = this . getParameter ( 'sysparm_tableName' ) ;
7+ var element = this . getParameter ( 'sysparm_element' ) ;
8+ var choiceCountGa = new GlideAggregate ( 'sys_choice' ) ;
9+ choiceCountGa . addAggregate ( 'COUNT' ) ;
10+ choiceCountGa . addQuery ( 'dependent_value' , choiceName ) ;
11+ choiceCountGa . addQuery ( 'inactive' , 'false' ) ;
12+ choiceCountGa . addQuery ( 'name' , tableName ) ;
13+ choiceCountGa . addQuery ( 'element' , element ) ;
14+ choiceCountGa . query ( ) ;
15+ while ( choiceCountGa . next ( ) ) {
16+ dependentChoiceCount = choiceCountGa . getAggregate ( 'COUNT' ) ;
17+ }
18+ return dependentChoiceCount ;
19+ } ,
20+ type : 'NumberOfDependentChoices'
21+ } ) ;
You can’t perform that action at this time.
0 commit comments