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.

write access acl to the field based on sys_user refrence field

abhijeet khale
Tera Contributor

I have to configure write ACL to specific field on the Stockroom Table. This "write" permission should be assined to the "Stockroom Manager (sys_user)"  field. 

 @Ankur Bawiskar  @Community Alums could you please suggest.

1 ACCEPTED SOLUTION

Not applicable

Hi @abhijeet khale ,

You can write business rule for the same. 

If logges_in user == Stockroom Manager , then only it will allow to save any changes.

 

Or You can apply the same logic in ACL script section, something like this.

// Get the current stockroom record
var gr = new GlideRecord('alm_stockroom');
if (gr.get(current.sys_id)) {
    // Check if the current user is the stockroom manager
    if (gr.manager == gs.getUserID()) {
        // Allow access
        answer = true;
    } else {
        // Deny access
        answer = false;
    }
} else {
    // Deny access if record is not found
    answer = false;
}

 

Thanks.

Hope it helps.

Mark it helpful and accept solution if my response turns useful.

View solution in original post

3 REPLIES 3

Not applicable

Hi @abhijeet khale ,

You can write business rule for the same. 

If logges_in user == Stockroom Manager , then only it will allow to save any changes.

 

Or You can apply the same logic in ACL script section, something like this.

// Get the current stockroom record
var gr = new GlideRecord('alm_stockroom');
if (gr.get(current.sys_id)) {
    // Check if the current user is the stockroom manager
    if (gr.manager == gs.getUserID()) {
        // Allow access
        answer = true;
    } else {
        // Deny access
        answer = false;
    }
} else {
    // Deny access if record is not found
    answer = false;
}

 

Thanks.

Hope it helps.

Mark it helpful and accept solution if my response turns useful.

Ankur Bawiskar
Tera Patron

@abhijeet khale 

so please share what did you start with and where are you stuck?

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

Thank you for quick response Ankur. My query has been resolved.