User Tools

Site Tools


background_scripts

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
background_scripts [2024/12/12 12:13] johnsonjohnbackground_scripts [2024/12/12 12:22] (current) johnsonjohn
Line 205: Line 205:
 ---- ----
  
-=====Unlock PROD=====+=====Unlock USER PROD=====
 <code> <code>
 +ClearUserLog();
 +//Log Time Started
 +UserLog("Script Started at" + gs.nowDateTime());
  
 +//Query Table
 +var gr = new GlideRecord("sys_user");
 +gr.addQuery('active', 'true');
 +gr.query();
 +    while (gr.next()) {
 +        gr.locked_out = false;
 +        gr.setWorkflow(false);
 +        gr.update();
 +    }
 +
 +//Log Time Ended
 +UserLog("Script Ended at" + gs.nowDateTime());
 </code> </code>
  
Line 214: Line 229:
 =====Update Time Zone===== =====Update Time Zone=====
 <code> <code>
 +ClearUserLog();
 +//Log Time Started
 +UserLog("Set TimeZone Started at" + gs.nowDateTime());
 +
 +//Query Table
 +var gr = new GlideRecord('sys_user');
 +gr.addNotNullQuery('location');
 +gr.addNullQuery('time_zone');
 +gr.query();
 +
 +//Update Records
 +while (gr.next()) {
 +    gr.time_zone = gr.location.time_zone;
 +    gr.setWorkflow(false);
 +    gr.update();
 +}
  
 +//Log Time Ended
 +UserLog("Set TimeZone Ended at" + gs.nowDateTime());
 </code> </code>
  
 ---- ----
background_scripts.1734034424.txt.gz · Last modified: 2024/12/12 12:13 by johnsonjohn