Assignment rules to execute on change of fields. in the form
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-19-2023 06:32 PM
Hi all,
Can anyone help here?
I got a requirement. where on the change of fields in the form (assignment group and business services of the xyz table) the assignment rule should execute
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-19-2023 06:58 PM
@Mahesh137
From the document,if the task has be assgned , assignment rules will not run.
However ,you can use BR or Data lookup rules to achive your requirement.
link: data lookup
The Assignment rules module allows you to automatically set a value in the assigned_to and assignment_group fields when a set of conditions occurs.
- The task record has been created or updated. Assignment rules do not apply to unsaved changes on a form.
- The task record must be unassigned. The record cannot have an existing value for either the assigned_to or assignment_group fields. Assignment rules cannot overwrite existing assignments (including assignments set by a default value or a previously run assignment rule).
- The assignment rule is the first rule that matches the table and conditions. If more than one assignment rule matches the conditions, only the rule with the lowest order value runs.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-19-2023 07:39 PM
@Mahesh137 You can create an onBefore Update business rule on your table as follows.
Here is the script
(function executeRule(current, previous /*null when async*/ ) {
// Add your code here
var evaluator = new GlideScopedEvaluator();
var ar = new GlideRecord('sysrule_assignment');
ar.addQuery('table', current.sys_class_name);
ar.orderBy('order');
ar.addActiveQuery();
ar.query();
var matched = false;
while (ar.next() && !matched) {
matched = GlideFilter.checkRecord(current, ar.condition);
if (matched)
break;
}
if (ar.group != "") {
current.assignment_group = ar.group.toString();
} else {
var vars = {
'current': current
};
var group = new GlideRecord('sys_user_group');
group.get(evaluator.evaluateScript(ar, 'script', vars));
current.assignment_group = group.sys_id.toString();
}
})(current, previous);