The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Restricting Hardware table data visibility based on location

FlaviaRoshni
Tera Contributor

Hi!

I'm trying to restrict my Hardware table data (alm_hardware), based on the logged in user's location.

 

For example:

Say Hardware A, B and C; Location 1 and 2; User x and y;

Hardware A and B is in Location 1; Hardware C is in Location 2;

User x is in location 1, user y is in location 2

 

If user x login into ServiceNow portal they should only see the Hardware Asset details of A and B in the alm_hardware.

If user y login into ServiceNow portal they should only see the Hardware Asset details of C in the alm_hardware.

 

How do I achieve this?

10 REPLIES 10

Samaksh Wani
Giga Sage
Giga Sage

Hello @FlaviaRoshni 

 

You need to create a Read ACL on the Hardware Table :-

 

 

var gr = new GlideRecord('sys_user');
var user = gs.getUserID();
gr.get(user);
gr.query();
if(gr.next()){
if(gr.location == current.location){
answer=true;
}
}

 

 

Plz Mark my Solution as Accept and Give me thumbs up, if you find it helpful.

 

Regards,

Samaksh

Thank you! The solution helped!

Hello @FlaviaRoshni 

 

As my response helped you, plz mark it accepted solution. It will help future members.

 

Regards,

Samaksh 

Hello @FlaviaRoshni 

 

If you find my response helpful, Please mark it as Accepted. it will help the future users to reach your post.

 

Regards,

Samaksh