Script Includes
Business rules are inherently tied to a database action. However, often you want to write code that is available in multiple places, perhaps creating utility functions or even creating your own data structures. Script Includes are designed specifically for this situation. The big advantage, aside from the separation that encourages efficient reuse, is that the code is only accessed and parsed on demand, meaning that your scripts only run when they need to. This process is cached, optimized, and controlled, giving meaningful performance benefits.
When you create a Script Include, you give the record a name. This is very different to the name of a business rule. The name in a Business Rule is purely descriptive, enabling you to find the script more easily. For a Script Include, the Name field must have a value identical to the name of the function or class you are defining, since it is used by the platform to identify the code when you try to call it. This means your Script...