Power Tools Script Library

The Power Tools Script Library allows you to store apex scripts as salesforce records and run them at your convenience with a push of a button or schedule them to run at a timing of your choice. The results of your apex scripts are returned and you can optionally store these results (debug log results and user debug lines) as a related record.

About Script Libary

The Script Library uses an anonymous block - executeAnonymous(), for running Apex Scripts within Salesforce. Please note the following about running Scripts:

Create a Script

New Script

  1. From the Scripts Tab, click on New.
    Lightside Scripts Tab

Script without a Schedule

  1. Enter the Script Name, Description and Apex Code and select the API Version that the Apex should run with.
  2. Optionally select to Save Debug Logs. This is especially useful to view the results of scheduled scripts.
  3. Click Quick Save or Save and Return
    Lightside Script without Schedule

Script with a Schedule

Scripts be scheduled to run at nominated times and intervals.
  1. Create a Script as per the 'Script without a Schedule Instructions above'.
  2. Add a Schedule Username, Schedule Password and Schedule Security Token.
    The Schedule Credentials are used to Authenticate the REST calls required to run the Script at a future (scheduled) time. The password and security token will be encrypted when saved.
    Lightside Script with Schedule
  3. You can confirm the credentials entered are valid by clicking the Validate Credentials button.
    • Credentials Successfully Validated:
      Lightside Script with Valid Credentials
    • Credentials are Invalid:
      Lightside Script with Failed Credentials
  4. Select a Schedule Frequency and complete its relevant fields:
    • Once: Schedule Date & Time
      Lightside Script with Schedule Once
    • Hourly: Schedule Date & Time and End Date & Time
      Lightside Script with Schedule Hourly
    • Weekly: Schedule Start Date, Schedule End Date, Preferred Start Time and Recurs Every Week On
      Lightside Script with Schedule Weekly
    • Monthly: Schedule Start Date, Schedule End Date, Preferred Start Time and Day of Month
      Lightside Script with Schedule Weekly
    • Click Quick Save or Save and Return

Run Scripts

Scheduled Scripts

Scheduled Scripts will run at their designated scheduled time as long as the Schedule Credentials have been entered and are valid.


Run a script manually from either:

Script Results

Displayed Script Results

After running a script the Script Results will be displayed, including the Script Results, User Debug and Debug Log.

Saved Script Results

If Save Debug Logs was selected on the Script record. A related Script Result record will have been saved. Click through to the record by clicking on the Script Result Number. The Script Results will then be displayed.