File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed
GlideRecord/Display list of records based on Users Location Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change 1+ Get the list of records based on the User's Location while getting the list of records
Original file line number Diff line number Diff line change 1+ // Business Rule to display the list of records based on the user's location
2+
3+ When to Run - Before Query
4+ Table - Any table in which you want to perform this script
5+ Scripts -
6+ ( function executeRule ( current , previous /*null when async*/ ) {
7+
8+ // Add your code here
9+ var current_user = gs . getUserID ( ) ;
10+
11+ var usr = new GlideRecord ( 'sys_user' ) ; // Query User Table
12+ usr . addQuery ( 'sys_id' , current_user ) ;
13+ usr . query ( ) ;
14+ if ( usr . next ( ) ) {
15+ if ( usr . location != '' ) {
16+ current . addQuery ( 'location=' + usr . location ) ; // Querying the user's location with current record location
17+ }
18+ }
19+ } ) ( current , previous ) ;
You can’t perform that action at this time.
0 commit comments