Sage CRM 2024 R1: Validate Scripts - A round up of essential articles

2 minute read time.

Validate Scripts in Sage CRM are defined against a specific field within a Screen. Each field within a screen can have its own Validate Script. This script targets the data entered in that field and performs validation checks based on pre-defined criteria.

These scripts run on the server when a user attempts to save a record. Their primary function is data validation. Validate Scripts can check the data entered in the field against pre-defined criteria and prevent the record from being saved if the data fails validation. They can also set error messages to guide the user towards correcting the issue.

Sage CRM offers two other types of Field Level Scripting:

  • Create Scripts
    • These scripts are executed on the server side whenever a screen is created. This allows system administrators to control how a screen behaves. They allow administrators to enforce specific business logic as a screen loads. They can be used for tasks like setting default values for fields, checking data for accuracy, or triggering specific actions when the screen loads.
  • OnChange Scripts
    • These scripts are executed on the client side (user's web browser) whenever the value in the field is changed. They offer more flexibility for dynamic behaviour on the user interface. OnChange Scripts can be used for various purposes:
      • Updating other fields based on the changed value.
      • Triggering calculations or data lookups based on user input.
      • Providing real-time feedback to the user regarding data validity or potential issues.

Each script type has its own scope and functionality. System Administrators should choose the appropriate script based on what they want to achieve:

  • For initial setup and default values: Create Scripts
  • For data validation during save: Validate Scripts
  • For dynamic behaviour as the user interacts with the field: OnChange Scripts

Below are the links to articles covering all aspects of work with Validate Scripts

Understanding Context, Scope of Reference and Scope of Effect

  • Scope of reference refers to the visibility and accessibility of variables, functions, and other named elements from a specific point in your Validate Script. It's about where you can look to find the definition of something you're using.
  • Scope of effect focuses on the parts of your data modified or impacted by a particular function or method. It's about what parts of Sage CRM experience the changes introduced by a specific script.

Controlling Fields in Screens

Controlling Fields in Search Screens

Mobile

For more complex validation logic or scenarios requiring interaction with a wider range of data within Sage CRM, consider using:

  • Escalation Rules
  • Table and Entity Level Scripts