Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

Need Help Creating ACL on alm_hardware Table Based on "Managed By Group"

sattar3
Tera Contributor

Hi Everyone,

 

I am trying to create an ACL on the alm_hardware table in ServiceNow. We have a custom field called u_managed_by_group on the hardware asset record.

 

The requirement is:

Only users who are members of the group specified in the u_managed_by_group field should be allowed to edit that hardware record.
All other users should have read-only access/not allowed to update.

 

Could someone please guide me through the step-by-step process to build this ACL?
If any scripts need to be written (for conditions or scripts within the ACL), please share those script as well.

 

@Ankur Bawiskar @Amit Gujarathi @Ravi Gaurav 

 

Thanks,

Sattar

8 REPLIES 8

Jaspal Singh
Mega Patron

Hi,

Try below with alm_hardware.* with type Write.

answer=false;

if(gs.getUser().isMemberOf(current.u_managed_by_group))
{
answer=true;
]

 

Ankur Bawiskar
Tera Patron

@sattar3 

it's an easy requirement and can be achieved without scripting

you can modify the existing Table.None WRITE ACL or Create a new one if it's not present

something like this in condition

u_managed_by_group [IS DYNAMIC] ONE OF MY GROUPS
55.png

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

@sattar3 

Hope you are doing good.

Did my reply answer your question?

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

Anupama Singh1
Tera Guru

Hi  @sattar3 

 

Create a record‑level write ACL on alm_hardware  table and use a script to allow updates only if the logged‑in user is a member of the group referenced in u_managed_by_group .
 
Script -
if (!current.u_managed_by_group) {
    // No group set - deny update
    answer = false;
} else {
    answer = gs.getUser().isMemberOf(current.u_managed_by_group);
}
 
Hope this answers your question. Please mark it as correct if it helped.👍