
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-27-2017 08:26 AM
I have a script include that I'm using as a condition for a UI Action. The requirement is that the user's domain must be a child of the Bronze domain, or the child of a child of the Bronze domain in order to see the button.
Here's the script include that I'm calling with the condition new domainConditionUtil().verifyCBPUser(gs.getUserID())
The logs show:
returning: 23e22c9c0fe9830023b222d8b1050e5d
dParent: 23e22c9c0fe9830023b222d8b1050e5d
dPParent: undefined
Where am I going wrong?
var domainConditionUtil = Class.create();
domainConditionUtil.prototype = Object.extendsObject(AbstractAjaxProcessor, {
verifyCBPUser: function(userID) {
//check to see if the parent domain of the user is the Bronze domain, or if the parent of the custom process domain is the Bronze domain
var u = new GlideRecord('sys_user');
u.get('sys_id',userID);
var uDomain = u.sys_domain;
var dParent = getParentDomain(uDomain);
//dParent = dParent.toString(); //adding this line didn't fix
gs.log('dParent: ' + dParent);
var dPParent = getParentDomain(dParent);
gs.log('dPParent: ' + dPParent);
if (dParent == '21af3de90f7b32000fe1f3f692050e78' || dPParent == '21af3de90f7b32000fe1f3f692050e78')
{
return true;
}
else
{
return false;
}
function getParentDomain(dID)
{
var thisDomain = new GlideRecord('domain');
thisDomain.addQuery('sys_id',dID);
thisDomain.query();
if (thisDomain.next())
{
gs.log('returning: ' + thisDomain.parent);
return thisDomain.parent;
}
}
},
type: 'domainConditionUtil'
});
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-27-2017 11:32 AM
The problem was that the user had no visibility to the parent field on the parent domain record. Once I added the intermediate domain to the 'visibility domains' in a group where this user is a member, the script include started working.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-27-2017 11:32 AM
The problem was that the user had no visibility to the parent field on the parent domain record. Once I added the intermediate domain to the 'visibility domains' in a group where this user is a member, the script include started working.