Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Troublesome Database Join

Russell Abbott
Kilo Sage

I'm having problems joining two tables

task_time_worked - logs time records on tasks

u_employee_hours - imported values from external system showing hours paid for each employee

 

Here's the where clause

 

tw_sys_created_by = eh_u_active_directory_id

 

When I attempt to run the join, the view freezes my session. I'm guessing because the task_time_worked is so large?

 

Do I need to add the user table here and reference the user table from both task_time_worked and u_employee_hours?

 

join.jpg

1 ACCEPTED SOLUTION

I think that is too advanced for the Where clause, but you can try with a before Query Business Rule using the database view as the table.  Your script would look like this:

(function executeRule(current, previous /*null when async*/) {
	current.addEncodedQuery('tw_sys_created_on>=javascript:gs.beginningOfLast3Months()');
})(current, previous);

I don't have a large time worked table, joined to your custom table, so I don't know if the Business Rule will run before the Where clause churns away and locks the session.

View solution in original post

6 REPLIES 6

I tested this just now and it looks like the BR does indeed run before the session gets locked up. I appreciate your time! Thanks

Good news, and you are welcome!