Query business rule help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sunday
I am trying to run a query business rule to check on multiple conditions which works one way or the other.
If I run the Ismemberof condition or the qc and/or condition within query BR separately it works. But when I try to combine both to check, only the qc condition works and does not include the ismemberof in encoded query.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
I had the logs where it showed up the exact query result based on condition.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
HI @imran rasheed ,
i have updated the script please add more if condition if you have more .
// Type: Query Business Rule (e.g., beforeQuery on your target table)
// Condition: Active = true
(function executeRule(current, previous /* null when async */) {
// Use the user's sys_id for reliable comparisons
var currentUser = gs.getUserID();
// Start the first OR branch: user-related fields
var userBlock = current.addQuery('assigned_to', currentUser);
userBlock.addOrCondition('opened_by', currentUser);
// Add root-level OR branches for group-based service owners
// NOTE: dot-walk uses a single dot and compares to sys_id values
if (gs.getUser().isMemberOf('ABC')) {
current.addOrQuery('parent.u_service_owner', '2122342312'); // ABC service owner sys_id
}
if (gs.getUser().isMemberOf('DEF')) {
current.addOrQuery('parent.u_service_owner', '232323432'); // DEF service owner sys_id
}
// No addEncodedQuery() here—let the query tree you built run as-is
})();
Thanks,
Rithika.ch
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
@imran rasheed if this is helpful please close the thread and accept the solution