- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago - last edited 3 weeks ago
i have a requirement in SC_TASK
Assignment group : ABC
state : Cancelled / Completed
Either in the SC_TASK form or in the SCTASK list ( inline editing) should not happen.
For SC_TASK form applyed UI policy -> read only once the state is changed to cancelled or completed. But manager is changing it from SCTASK list ( Servicenow system is allowing).
can any one of you suggest ACL for the above requirement.
what i have done is:
1. create a new ACL
type : record
operation : write
decision type : Deny unless
name : Sc_task -------field : State
Applied to: blank
Roles: given X_abc_role (custom role create for a scoped application table)
Data condition: State -- is not one of -- ( selected closed complete and cancelled) and
assignment group -- is -- ABC
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
before update BR should work for Form (Native or Workspace), List (Native or Workspace)
where it didn't work?
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @LVPhanee
Step 1: Create a before insert/update BR
- Navigate to System Definition > Business Rules and click New.
- Fill out the form:
- Name: Restrict Edits on Completed/Cancelled ABC Tasks
- Table: Catalog Task (sc_task)
- Active: Checked
- Advanced: Checked
- Under the When to run tab, configure the following conditions:
- When: Before
- Insert: Checked
- Update: Checked
- Filter Conditions:
- Assignment group is Assignment group ABC
- State is one of Closed Complete, Closed Incomplete, Closed Skipped, Cancelled
- Under the Actions tab, set the Task update message:
- Abort action: Checked
- Add message: You cannot edit this task because it is already Completed or Cancelled.
- In the Script tab, paste the following code:
(function executeRule(current, previous /*null when async*/) {
gs.addErrorMessage(gs.getMessage('You cannot edit this task because it is already Completed or Cancelled.'));
current.setAbortAction(true);
})(current, previous);
Step 2: Create a List_edit ACL
Navigate to System Security > Access Control (ACL) and click New.
Fill out the ACL:
- Type: record
- Operation: list_edit
- Name: sc_task (Select sc_task.* ) //do not select any field
In the Requires role list, add the roles that should bypass this restriction (e.g., admin).
In the Condition builder, define the restriction so that it is only editable when the task is not closed:
- State is one of Closed Complete, Closed Incomplete, Closed Skipped, Cancelled
In advance script, answer = false;
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @LVPhanee
Step 1: Create a before insert/update BR
- Navigate to System Definition > Business Rules and click New.
- Fill out the form:
- Name: Restrict Edits on Completed/Cancelled ABC Tasks
- Table: Catalog Task (sc_task)
- Active: Checked
- Advanced: Checked
- Under the When to run tab, configure the following conditions:
- When: Before
- Insert: Checked
- Update: Checked
- Filter Conditions:
- Assignment group is Assignment group ABC
- State is one of Closed Complete, Closed Incomplete, Closed Skipped, Cancelled
- Under the Actions tab, set the Task update message:
- Abort action: Checked
- Add message: You cannot edit this task because it is already Completed or Cancelled.
- In the Script tab, paste the following code:
(function executeRule(current, previous /*null when async*/) {
gs.addErrorMessage(gs.getMessage('You cannot edit this task because it is already Completed or Cancelled.'));
current.setAbortAction(true);
})(current, previous);
Step 2: Create a List_edit ACL
Navigate to System Security > Access Control (ACL) and click New.
Fill out the ACL:
- Type: record
- Operation: list_edit
- Name: sc_task (Select sc_task.* ) //do not select any field
In the Requires role list, add the roles that should bypass this restriction (e.g., admin).
In the Condition builder, define the restriction so that it is only editable when the task is not closed:
- State is one of Closed Complete, Closed Incomplete, Closed Skipped, Cancelled
In advance script, answer = false;
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
At the production CAB call, for this requirement they suggested not to go with ACL, as it is project requirement not the security requirement.
Can you suggest another alternative. say Via. Client script -> 'oncell edit'