Some PDIs are currently unavailable, and PDI actions are paused. View the latest updates here. Read More

Change event field from work to standby

DullaB
Giga Contributor

Under Shift Planning we have Agent Schedule.

Double-click the row field called Work in the Event column against the filtered schedule entry

Modify the Type field by selecting Standby from the dropdown menu  replaces "Work" type).

How can we achieve this scenario using acl. I have created table and field level write acl permission but it's edited all the fields I the work record I need to edit only event field that to work record to standby can you guys suggest methe better approach 

3 REPLIES 3

Vikram Reddy
Tera Guru

Hey @DullaB,

 

sn_shift_planning_event.type            write ACL -> role: shift_editor (allow)
sn_shift_planning_event (no field, table level)  write ACL -> role: shift_editor (allow)
sn_shift_planning_event.start_date      write ACL -> role: admin (blocks shift_editor)
sn_shift_planning_event.duration        write ACL -> role: admin (blocks shift_editor)
sn_shift_planning_event.event_category  write ACL -> role: admin (blocks shift_editor)

A field ACL can only narrow what the table-level write ACL already allows, it can never grant more. So the moment your table-level write ACL lets that role save the sn_shift_planning_event record at all, every field without its own field ACL just inherits that same write access, which is why locking down "type" alone did nothing. Keep the table-level write ACL (you need it to save the record in the first place), then add an explicit write ACL on every other field that excludes your role, leaving only type open.

 

Thank you,
Vikram Karety
Octigo Solutions INC

Tanushree Maiti
Tera Patron

Hi @DullaB 

 

First using Debug Security / using Access Analyzer , try to trace what ACL is granting write access

 

Create the ACL: Go to System Security > Access Control (ACL) > click New.

  • Type: record
  • Operation: write
  • Name: Select your Event table (like  cmn_schedule_span). Set the field to Type.
  • Requires role: Add the roles necessary to perform this action (like sn_shift_admin or shift_planner).

Under the Requires role or Condition fields, you can also write a script to ensure the agent or shift planner owns or manages that roster.

Please Accept the solution if it assisted you with your question & Mark this response as Helpful.
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti

ajmalmuhamm
Tera Contributor

If you want to allow users to change only the Event Type from "Work" to "Standby" and prevent them from editing any other fields, then Table ACLs and Field ACLs alone are not sufficient. Once a user has write access to the record, they can modify any writable field unless additional logic restricts it.

A better approach would be:

  1. Keep the table/field ACLs so only the intended users can update the record.
  2. Create a Before Update Business Rule on the Agent Schedule table.
  3. In the Business Rule:
    • Check whether the current user has the required role.
    • Allow the update only if:
      • The only changed field is Event (Type).
      • The previous value is Work.
      • The new value is Standby.
    • If any other field is modified, or if the Event is changed to a value other than Standby, abort the update and display an error message.

Example logic:

 
if (!gs.hasRole('your_role')) {
    return;
}

// Allow only Event field to change
var allowed =
    current.type.changes() &&
    previous.type == 'work' &&
    current.type == 'standby' &&
    !current.start_date.changes() &&
    !current.end_date.changes() &&
    !current.agent.changes();// Add checks for other fields as required

if (!allowed) {
    gs.addErrorMessage("Only the Event Type can be changed from Work to Standby.");
    current.setAbortAction(true);
}
 

Alternatively, if this action is performed from the Agent Schedule workspace, an even cleaner solution is to:

  • Make the form read-only for all fields.
  • Provide a UI Action/Workspace Action called "Set to Standby".
  • The action updates only the Event Type from Work to Standby through server-side logic.
  • Users never receive general edit access, making this the most secure and maintainable approach.

So, rather than relying solely on ACLs, I'd recommend using a combination of ACLs + Business Rule or, preferably, a dedicated UI Action if the requirement is to allow only this single operation. This gives you much finer control than ACLs alone.