- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-28-2025 01:19 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-29-2025 12:20 AM
Hello @RamcharanA, I'm not sure why you'd like to go for this approach when there are better approaches, highlighted earlier, available. Nevertheless, here are the SI and CS as asked:
- Script Include: ensure its client callable as depicted below
Here is the script to be used in SI
var TestRestrictChangeInactiveAssignedGroup = Class.create();
TestRestrictChangeInactiveAssignedGroup.prototype = Object.extendsObject(AbstractAjaxProcessor, {
inactiveGroupCheck: function(){
var assignedGroup = this.getParameter('sysparm_assignedGroup');
var grGroup = new GlideRecord('sys_user_group');
grGroup.get(assignedGroup);
grGroup.addActiveQuery();
grGroup.query();
return grGroup.hasNext();
},
type: 'TestRestrictChangeInactiveAssignedGroup'
});
- Client Script: its configured to run only for new record, if you wish to run it for existing Change too then remove the first if condition
Here is the script to be used
function onSubmit() {
//Runs only for new record
if (g_form.isNewRecord()) { // remove if condition here if to be run for update too
var gaAssignedGroup = new GlideAjax('TestRestrictChangeInactiveAssignedGroup');
gaAssignedGroup.addParam('sysparm_name', 'inactiveGroupCheck');
gaAssignedGroup.addParam('sysparm_assignedGroup', g_form.getValue('assignment_group'));
gaAssignedGroup.getXMLWait(); // doesn't work in portal
var isActiveGroup = gaAssignedGroup.getAnswer();
if (isActiveGroup === 'false') {
g_form.addErrorMessage('Selected Group is inactive');
return false;
}
}
}
Regards,
Nishant
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-28-2025 07:08 AM
Hi @RamcharanA ,
You can create Business rule to achieve your goal but more simple way is to configure "Reference qual condition" so that only active group is displayed at assignement group field.
Right click at "Assignment group" field and select Configure Dictionary.
Add filter condition like this. As a result, only active group can be selected at assignment group field. (inactive group is not displayed)
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-28-2025 08:56 AM
Hi @shun6 i need to write script include and call that script in onSubmit client script do you have any suggestions please let me know.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-28-2025 08:47 AM
Hello @RamcharanA , There are couple of ways you can achieve this - proactively (updating the reference qualifier) or reactive (using Business Rule to prevent).
I'll suggest to use proactive approach so that no one can pick inactive group from the field, however sharing both the approaches below
1. Assignment Group dictionary change
Go to to Configure Dictionary and under Dictionary Overrides related list click New button and configure as below
2. Write Business rule on change_request table as below:
Regards,
Nishant
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-28-2025 08:55 AM
Hi @Nishant8 i need to write script include and call that script in onSubmit client script do you have any suggestions please let me know.