We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 57a839e commit 9d9a7f2Copy full SHA for 9d9a7f2
Server-Side Components/Script Includes/Prevent circular dependencies in task relationships./code.js
@@ -0,0 +1,26 @@
1
+var DependencyChecker = Class.create();
2
+DependencyChecker.prototype = {
3
+ initialize: function() {},
4
+
5
+ hasCircularReference: function(taskId) {
6
+ var visited = {};
7
+ return this._check(taskId, visited);
8
+ },
9
10
+ _check: function(taskId, visited) {
11
+ if (visited[taskId]) return true;
12
+ visited[taskId] = true;
13
14
+ var gr = new GlideRecord('task_dependency');
15
+ gr.addQuery('dependent_task', taskId);
16
+ gr.query();
17
18
+ while (gr.next()) {
19
+ if (this._check(gr.task.toString(), visited)) return true;
20
+ }
21
22
+ return false;
23
24
25
+ type: 'DependencyChecker'
26
+};
0 commit comments