- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-29-2025 04:18 AM
I need to prevent users from being able to create new change tasks where type = type A, these tasks can only be created automatically when a Change Request is progressed to the Assess state.
I have a before insert business rule that is running on the change_task table where the task type = type A to prevent submission & display error message, which works.
The issue I have is when a Change Request move to the Assess state, the change request is displaying the error message. the change task is being created automatically & and it shows in the change_task table as being created by the same user ID as the person creating the change req. I want this error msg to only be displayed on the change task itself where a user is creating it directly from the change_task table.
How can I prevent this error message from being displayed on the change request form when the change req state triggers the creation of the task type = type a.
Business rule is:
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-29-2025 06:01 AM
I was able to reach a solution by setting the following filter conditions on my business rule, have tested it across different scenarios and seems to be doing what I needed, thank you for you suggestion of using filters, wouldn't have thought of doing it this way otherwise:

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-29-2025 04:53 AM
@thrsdy1512 Please update the business rule script as follows and see if it works for you.
(function executeRule(current, previous /*null when async*/) {
if (current.change_task_type == 'peer_review'&¤t.parent.state!='-4') {
gs.addErrorMessage('This task cannot be created by users. This can only be created by the system when progressing a Change request.');
// Prevent the record from being saved
current.setAbortAction(true);
}
}
)(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-29-2025 05:34 AM
Unfortunately this didn't work. The message still displays when the change request moves to Assess and a task is created automatically. I want to the message to only display if a user is creating a new task directly from the change task table.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-29-2025 05:13 AM
2 ways
1) don't show New button when the CHG State = Assess, this can be handled via Table level CREATE ACL
OR
2) Before insert BR
you can do this without scripting as well. you need to add the interactive session check so that this BR stops insertion only when some user tries to create task and not when it gets created from backend
BR Condition: gs.getSession().isInteractive()
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-29-2025 05:37 AM
There ACLs in place that hide the 'New' button from the related lists tab on a change request, I am trying to prevent users from clicking 'New' in the change task table and creating the tasks that way. I have been able to prevent submit on these but the error message is displaying on change requests where tasks are generated automatically as part of progressing the change to the next stage. I need the error message to be hidden if the task is created by transitioning the change state from New to Assess.