Skip to content

Commit 22a2e4a

Browse files
Create NumberOfDependentChoices.js
Script Include to find number of dependent choices of selected choice
1 parent 82652b2 commit 22a2e4a

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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+
});

0 commit comments

Comments
 (0)