Comments on: Advanced ‘getMyGroups’ Function https://servicenowguru.com/system-definition/advanced-getmygroups-function/ ServiceNow Consulting Scripting Administration Development Tue, 28 May 2024 21:21:51 +0000 hourly 1 https://wordpress.org/?v=6.8.2 By: Billi L https://servicenowguru.com/system-definition/advanced-getmygroups-function/#comment-7030 Tue, 10 May 2016 18:41:53 +0000 https://servicenowguru.wpengine.com/?p=1672#comment-7030 I tried using a similar script to add a parent group member to child groups upon insert. Do you have a business rule or SI that is similar to accomplish this?

]]>
By: Jean-Luc https://servicenowguru.com/system-definition/advanced-getmygroups-function/#comment-7029 Fri, 04 Mar 2016 13:05:25 +0000 https://servicenowguru.wpengine.com/?p=1672#comment-7029 I’ve got the same problem on Geneva. If the user is non admin and glide.script.use.sandbox is true then the returned groups from the module ‘My Groups work’ is empty. What is strange is when the same function is called from a script in an application menu is works. I try to set glide.script.use.sandbox to false but I got and error message saying this operation is unsafe.

Finaly I’ve succeeded with the following code :

var GMGA = Class.create();
GMGA.prototype = Object.extendsObject(AbstractAjaxProcessor, {
type: ‘GMGA’
});
var maxDepth;

var groupArr = [];
var finalArr = [];

GMGA.getMyGroupsAdvanced = function (inputDepth) {

….

The rest of the code is untouched.
For calling the function use : javascript:GMGA.getMyGroupsAdvanced(5)’

For me it’s a kind of black magic!

]]>
By: William https://servicenowguru.com/system-definition/advanced-getmygroups-function/#comment-7028 Thu, 10 Dec 2015 20:01:57 +0000 https://servicenowguru.wpengine.com/?p=1672#comment-7028 I notice this pulls from the Task table but I need to get a state from the incident table, any suggestions on how I can accomplish this?

]]>
By: Tony Nelson https://servicenowguru.com/system-definition/advanced-getmygroups-function/#comment-7027 Mon, 12 Jan 2015 16:53:49 +0000 https://servicenowguru.wpengine.com/?p=1672#comment-7027 In reply to Tony Nelson.

I should have dug through the thread better. The problem I was experience was addressed by Ahmed Abdrabalnabi above. After reading the thread I checked and sure enough the issue would not occur if the user had the admin role. So I checked the system property of “glide.script.use.sandbox” and found it was set to true…changed that to false and it now works. I will admit that it still doesn’t make complete sense because that property itself states “If enabled, only those business rules and script includes with the “Client callable” checkbox set to true are available” and as stated, the script includes here has “Client callable” checked. I did confirm that I didn’t miss that. Just a bit strange.

]]>
By: Tony Nelson https://servicenowguru.com/system-definition/advanced-getmygroups-function/#comment-7026 Mon, 12 Jan 2015 16:16:10 +0000 https://servicenowguru.wpengine.com/?p=1672#comment-7026 Mark,

We have been successfully using this for a number of years now. We are currently on Calgary testing Eureka. In Eureka when I go to “My Groups Work”, in the assignment group field of the filter it is blank. We have indeed changed the old global Business Rule to the new Script Includes. I know we have a lot of groups that the manager is not an assignee in the group but wants that visibility which this has done. Any thoughts?

]]>
By: Mark Stanger https://servicenowguru.com/system-definition/advanced-getmygroups-function/#comment-7025 Mon, 14 Jul 2014 21:31:36 +0000 https://servicenowguru.wpengine.com/?p=1672#comment-7025 In reply to Howard Elton.

I’ve just updated this to use a script include instead of a global business rule. That should solve the error you’re getting. Performance should really be the same, but this will follow current best-practice more closely.

]]>
By: Mark Stanger https://servicenowguru.com/system-definition/advanced-getmygroups-function/#comment-7024 Mon, 14 Jul 2014 13:56:29 +0000 https://servicenowguru.wpengine.com/?p=1672#comment-7024 In reply to Howard Elton.

I haven’t ever had anyone report an issue related to this. The only code outside of a function are a couple of variable declarations so there shouldn’t be a huge concern.

]]>
By: Howard Elton https://servicenowguru.com/system-definition/advanced-getmygroups-function/#comment-7023 Mon, 14 Jul 2014 05:18:17 +0000 https://servicenowguru.wpengine.com/?p=1672#comment-7023 Hi Mark,
I did this in Dublin and it spits out this warning when I save the rule”getMyGroupsAdvanced Business Rule contains code outside of a function. Code which exists outside of a function will run against every transaction; therefore, all code should be within a function and invoked as needed.”. I am a bit hesitant to turn it on now, as it seems serious.

Any ideas?
Regards,
Howard Elton

]]>
By: Tony Nelson https://servicenowguru.com/system-definition/advanced-getmygroups-function/#comment-7022 Tue, 03 Sep 2013 15:37:47 +0000 https://servicenowguru.wpengine.com/?p=1672#comment-7022 In reply to Tony Nelson.

another note…if I go to demo and put this into an instance with Calgary it works. It seems to be related to the upgrade with this in place.

]]>
By: Tony Nelson https://servicenowguru.com/system-definition/advanced-getmygroups-function/#comment-7021 Tue, 20 Aug 2013 16:28:56 +0000 https://servicenowguru.wpengine.com/?p=1672#comment-7021 This was working fine for us until we started testing Calgary and then I ran into the same issues discussed above. This only works for users who have the admin role. We currently do NOT have the High Security plugin enabled so that isn’t the issue. I tried commenting out the following line as suggested by Jeff above with no luck:

//Remove any duplicates from group string
groupArr = checkDuplicates(groupArr);

Did anyone find a solution to this with Berlin?

]]>