Using trace
SuperOffice CRM Online has a built-in tracing feature. When turned on, all details will be logged when the script is run. You can then investigate the behavior of the script step by step by rewinding and fast-forwarding the log. You can also see all the variables at any given point.
Starting a trace
- Bring up your script in SuperOffice Settings and maintenance.
- Click Trace script.
- Make sure the trace has a description and is enabled.
- Optionally, set User filter if you want a user-specific trace.
- Optionally, enable notifications.
- Optionally, specify sampling frequency, expiration, and exception-only tracing.
- Click OK.
Now you've activated tracing on the script. Keep this tab open for now. In a new tab, do the task that will trigger the script. For example, if your script should run before saving a company, go to a company card, click Edit and then click Save. Return to the open trace tab.
Inspecting a trace
Click Refresh and select the row from the recent run.
- The left side shows the script. The row you're tracing is highlighted.
- The right side shows all available variables. Click the ellipse (…) to expand.
Use the slider or the Step buttons to "re-run" the script and explore the variables and statements.
When you are done, or want to update your script, click Return.
Call stack depth
CRMScript keeps track of its current call stack depth, and saves it with the tracing information.
Consecutive code lines are usually at the same depth. Staying at a certain depth means that you don't step into functions being called.
Using the call-stack depth, you can do much more advanced stepping when inspecting a trace:
Step back: Go back to the previous statement at the current depth.
Step in: Go to the next trace frame.
Step out scope: Exit current scope (for example a loop) and go to the next statement.
Step out: Exit current function and go to the next statement.
Step next: Go to the next statement at the same depth or higher in the stack.
Max number of trace-runs and storage
A script trace will be disabled when it has traced 100 times or the sum of saved data for that trace reaches 100MB. If you have reached the limit, manually delete some trace-runs or wait until they expire. Expired trace-runs are automatically deleted nightly. Remember to re-enable the trace to resume tracing.
The number of runs and accumulated data size are shown per trace and in the list of traces.
Consider when and what you need to trace. The Only trace when it is required checkbox logs only unhandled exceptions or if the function forceSaveTrace(true)
is called within the script. Pair this with notifications to monitor your scripts.
Notifications
While editing the trace, you have the option to enable notifications. This feature pairs well with the exception-only setting. Input the email address where you'd like notifications sent after saving a trace run. To avoid excessive emails, indicate the number of emails you wish to dispatch; this count will decrease with each email sent.