how do i get the current domain of current user using scripts in ACL?

reeba1
Tera Contributor

Hello,

How do i get the current domain of current user using scripts in ACL? after i get the current domain, the users of sys_user table should be restricted, ie, the users whose domain is same as the current domain should only have the access.

How can i implement it using scripts in ACL? Can someone help me with this, with some example?

Regards,

Reeba

1 ACCEPTED SOLUTION

Can you try like,

 

find_real_file.png

 

Click on the search field in script and the select show related field and then expand the list and select Domain => Domain field and then again expand the list and select sys_id, like

 

find_real_file.png  find_real_file.png

find_real_file.png

View solution in original post

13 REPLIES 13

AirSquire
Tera Guru

Hi Reeb,

Below code will give you sys_id of the domain record

gs.getUser().getDomainID();

 

Regards
Dhruv

reeba1
Tera Contributor

Hi Dhruv,

 

Thankyou for your reply. Can we use GlideRecord in ACL scripts?

 

Regards,

Reeba

yes we can.

Regards
Dhruv

reeba1
Tera Contributor

Hello Dhruv,

I have written this code:

var domaine = gs.getUser().getDomainID();
var gruser = new GlideRecord('sys_user');
gruser.addQuery('sys_domain',domaine);
gruser.query();
while(gruser.next())
{
answer = gruser.getDisplayName();
//return(answer);
}

 

But the it is showing all records match this condition. Can you suggest any changes so that the users are restricted. I have attached the screenshot.

Regards,

Reeba

You cannot apply filter to results of a field using ACL(I just read the post of you requirement right-now, a bit late). It needs to be done some other way.

Regards
Dhruv