Skip to main content

Execute Apex

Realfire allows you to execute Apex script using Salesforce Execute Anonymous feature. You can use this to invoke small Apex script to quickly executorTest something or invoke other processes or to start Queueable to Batch Jobs.

You compose/edit the Apex script inside an Apex Editor. Depending on the editions, you can create one or more Apex Editors and execute the script with them.

Open Apex Editor

Apex Editor can be opened in following ways.

  • Click on the Apex Editor main toolbar icon

  • Right click on Connection and chose Open Apex Editor

Execute Apex Script

Once you open the Apex editor enter your Apex script to be executed. To execute a script, you select the text and execute it.

You can invoke Execute in following ways.

  • Click on the Execute icon in the toolbar

  • Right click on the selected Text and choose Execute

::: warning Note that if you do NOT select any text and click on Execute, system will execute complete text in the Editor :::

Execution Result

Upon execution, system will show the result of execute in a Console view. Console should open automatically at the end of the execution if it is not already open and is shown below.

Console result in case of error.

Based on the Preferences, console view will show only the User Debug statements (default) or full log. You can open the full debug log in Debug Log viewer by clicking on the Open the Debug Viewer icon.

Console Actions

Console provides few actions to help with debug log viewing and text highlighting.

ActionDescription
Open Debug ViewerOpens the latest debug log in full Debug Viewer
Save Debug LogSaves the Debug Log so you can open the log later. Saved logs can be viewed from Debug Logs editor.
Search ConsoleIf you want to search for some text in console, you can click this button which will open a window with current console text where you can search
Clear ConsoleClears the current text from the console
Edit Highlight PatternsThis allows you to edit Regex patterns to highlight lines in the console. See below for more info.

Edit Console Highlight Patterns

Realfire comes bundled with Grep Console which allows you to define Regex patterns and highlight styles. After that it will highlight the lines containing the matching text.

By default Realfire comes with following patterns.

  • Debug (line containing [DEBUG])
  • Warning (line containing [WARN])
  • Error (line containing [ERROR])
  • Fatal (line containing [FATAL])
  • User Debug (line containing USER_DEBUG)
  • Salesforce Id (text which looks like Salesforce Id)

Here is how various highlighted lines looks like

You can disable a particular highlight in Edit Highlight Patterns dialog as below. Click on the first icon till it looks like empty square. Refer to Grep Console Docs for more details on how to disable/enable various patterns.