Need Business Rule condition to check related list
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2015 09:27 AM
Hello,
On our change form, we've added a related list by creating a new "Relationship" called "User Notification". This shows any user notification(s) created that is associated with the current change record. The user notification is a catalog item.
I created the following Business Rule to redirect user to the notification form from the change record (if "User Impact" is selected). I need a condition to check if there's already an existing user notification associated with the change record. If there is an existing user notification, I do not want to run the business rule. Not quite sure what condition to put. Any help would be appreciated.
Thanks,
Maria

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2015 09:56 AM
Hi Maria,
How are you maintaining the relationship between the change record and the requested item? I mean from which table you pull the data to show in the related list and using which conditions?
I think same can be used in the business rule to avoid duplication.
Thanks
Mandar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2015 10:20 AM
Echoing Mandar Vedak, where do you store the notifications so a check can be made? In theory, a complex condition can be implemented inside the business rule body with no significant loss of performance. The business rule is equivalent to
if (condition) then {
business-rule-body
}
So it is fine to put part of the condition at the top of the body. The downside is that this kind of format will look wrong during debugging as it will show the BR being run even though the BR body is then ignored due to the complex condition.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2015 11:27 AM
Hello Maria,
For your case condition can't be put in condition field beause you are running the business rule on change table and checking the record on related list. the condition needs to be put in script body.You need to first fetch record from related table for current change record using GlideRecord and if record found than you need to check condition eg:
var parentChange = current.sys_id; //sysId of current change
var gr = new GlideRecord('Your_Notification_table');
gr.addQuery('Relative_field_between_notification_and_change', parentChange);
gr.query();
if(!gr.hasNext()) //if there is no record in related list for current change
{
//You Business rule code statements
}
Regards,
Sachin