General
This article provides recommended practices for writing maintainable and reliable scripts.
Keep Scripts Readable
- Use clear variable and function names
- Keep logic simple and structured
Use Functions
Break complex logic into smaller reusable functions.
Avoid Code Duplication
Move shared logic into reusable scripts or functions.
Use Logging
Log important values and decisions during execution:
LogService.SaveTransactionLog(0, transaction.Id, "Debug", "Value: " + value, "Script");Validate Data
Always check for:
- null values
- empty strings
- invalid numbers
Test Incrementally
- Start with simple cases
- Expand testing gradually
Use Script Library
Store reusable logic centrally.