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 7ce7cd9 commit 7008cc6Copy full SHA for 7008cc6
Background Scripts/Get My Groups/getMyGroups.js
@@ -0,0 +1,12 @@
1
+// Get current user's group
2
+var currentUserGroups = gs.getUser().getMyGroups();
3
+
4
+// Check that the collection object type is JavaObject or not
5
+if (Object.prototype.toString.call(currentUserGroups).match(/^\[object\s(.*)\]$/)[1] == "JavaObject") {
6
+ // ArrayUtil can be used to create a JS Array from Java collection object
7
+ var arrayUtil = new global.ArrayUtil();
8
+ currentUserGroups = arrayUtil.convertArray(currentUserGroups);
9
+}
10
11
+gs.info(currentUserGroups);
12
+gs.info('Object type: ' + Object.prototype.toString.call(currentUserGroups));
0 commit comments