Best practices for Relativity scripts

Relativity scripts are a powerful way to extend Relativity. Because of this, they can cause problems if used incorrectly. This section outlines some of those potential problems and how to avoid them.

Verify your security permissions

We recommend that only Relativity and SQL experts who are familiar with XML be in charge of creating, testing, maintaining, and altering Relativity scripts.

You must have the appropriate system admin permissions to work with scripts. For more information, see Security and Permissions on the Relativity RelativityOne Documentation site.

Avoid errors and performance issues

Any statement that can be written in SQL can be written into a Relativity script. In theory, you could create a script that completely erases your workspace's document table.

In addition, some scripts can negatively impact system performance if run during peak hours.

You can avoid these problems by:

  • Allowing only experts to write scripts
  • Allowing only experts to run scripts
  • Testing scripts in test workspaces only, not in those being used for an actual case

Upgrade scripts for database schema changes

Relativity occasionally makes changes to the database schema. Accordingly, not all scripts work on all versions of Relativity. If upgrading to a new version, you may need to update your references.

To test whether your script references need updating, run the SQL portion of the script in SQL Server Management Studio. If the script fails, it will throw an error message and attempt to identify the problem. If it succeeds, it will either advise you how many rows were affected or return the rows queried for.

If you have a Relativity test instance, deploy the latest version and test your scripts prior to upgrading the production environment.

Contact Support when necessary

Relativity Support is available to assist with any questions, comments, or concerns.

If you are writing scripts, we recommend that you attend infrastructure training to learn more about Relativity architecture. For more information, see Relativity Infrastructure Training.