Assignment group mandatory
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-16-2024 11:26 PM
Hello Team
In my servicenow instance when we closed sc task after that ritm automatically get closed.
but i want if assignment group is empty ritm will never close and it will abort that action.
can u please help me with that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-16-2024 11:32 PM
hi @Shrabanti ,
Configure the Business Rule:
Table: Select sc_task.
When to run: Set the conditions under which the rule should run:
When: After
Insert: Unchecked
Update: Checked
Delete: Unchecked
Add a condition to check if the state of the task is being set to closed.
var ritm = new GlideRecord('sc_req_item');
if (ritm.get(current.request_item)) {
if (JSUtil.nil(ritm.assignment_group)) {
gs.addErrorMessage("Cannot close RITM as Assignment Group is empty.");
current.setAbortAction(true);
}
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-16-2024 11:38 PM - edited ‎07-16-2024 11:47 PM
Hi @Shrabanti , You can write a business rule on sc_task table to check the assignment group of RITM when the sctask is getting closed, if it is empty then abort the action.
(function executeRule(current, previous /*null when async*/ ) {
var checkRITMGrp = new GlideRecord('sc_req_item');
if (checkRITMGrp.get(current.request_item)) {
if (checkRITMGrp.assignment_group == '' || checkRITMGrp.assignment_group == NULL) {
gs.addErrorMessage('Task cannot be closed as RITM(s)Assignment Group is empty.');
current.setAbortAction(true);
}
}
})(current, previous);
Result:
Mark this as Helpful / Accept the Solution if this helps
Mark this as Helpful / Accept the Solution if this helps.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-16-2024 11:38 PM
Hello @Shrabanti ,
Requested Item is automatically closed after all sc tasks get closed. It is the Out of the box functionality. If you wanted as your requirement, you need to over write Out of the box functionality.
Mark my answer helpful and correct, if it helps you
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-17-2024 12:28 AM
Hello @Shrabanti ,
Write a Before BR on catalog task table(sc_task) with the condition as "assignment group changes to closed complete",
and follow the code as below