Complex query Business Rule

TZRick
Kilo Explorer

Hi everyone,

 

I have a requirement to expand the scope of Requester/ESS Users to allow them to see not just Incidents where they are Caller/Opened By/Watch List, but also where they have management oversight of retail locations in their district.

 

I have the ACL done (added a new read Incident ACL alongside the stock ones), but I'm trying to build an incident query Business Rule..

 

Questions:   How do I add additional conditions OR'd to the stock conditions?   As a possible solution, am I able to create multiple query Business Rules to return multiple datasets...for instance, keep the stock rule active and just add another alongside?

 

Here is what the solution query should look like (simplified):

  • ((NotNullQuery) AND (NotNullQuery) AND (Query)) OR
  • (Caller=user OR Opened By=user OR Watch List=user) --> Stock incident query Business Rule

 

Any ideas as to how to approach this?

 

Thanks in advance.

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

UPDATE:

I tried the following:

1.   Enabling both the stock Business Rule as well as the custom Business Rule.   The custom Business Rule worked, but when enabling the stock Business Rule, the results were again limited to stock limits.

 

2.   I've tried to add an OR condition to the stock Query Condition line, but am getting an error using that syntax (should work per the Wiki).

Error:   org.mozilla.javascript.EvaluatorException: Can't find method com.glide.db.conditions.QueryCondition.addOrCondition(string)

Code:  

var qc = current.addQuery("caller_id", curr_user).addOrCondition("opened_by", curr_user).addOrCondition("watch_list", "CONTAINS", curr_user).addOrCondition('encoded_query_string_here');
1 ACCEPTED SOLUTION

Sometimes when the query gets too complicated I go to a list of records and build the query with the condition builder at the top. If you include the logic from the stock business rule in your query as well then you can just add it all in one query with a simple addQuery('encoded_query_here'). It looks like that may be the best way to do it here. I know you can do the larger grouping of OR conditions that way.


View solution in original post

6 REPLIES 6

Ok...replies crossed again.   Will try your last suggestion.


Alright James Farrer...based on you reminding me...I begrudgingly went back to the list view and was able to get the encoded query method to work.



Thanks for your help!