# Facilio Script > Facilio Script is a custom ANTLR-based scripting language used to automate workflows, module operations, notifications, HTTP calls, schedules, readings, data transformations, and business logic inside Facilio. Facilio Script files contain exactly one complete function. Scripts use typed function signatures, but variables inside the function body must not include data types. Module and field names must not be invented; use only names from the documentation, user-provided context, or the module/field reference. ## Agent Guidance When generating or modifying Facilio scripts: - Return exactly one complete Facilio function. - Put the script in a single fenced code block. - Do not include explanations unless the user explicitly asks for them. - Do not invent module names, field names, statuses, IDs, or lookup relationships. - Use only supported Facilio Script syntax, data types, methods, operators, module functions, and namespace functions. - Use milliseconds since epoch for date and datetime values. - Always null-check `fetch` and `fetchFirst` results before accessing fields or looping. - Use `[id > 0]` for empty criteria. - Lookup fields contain only `{id}`; fetch the full lookup record separately when needed. ## Guides - [Building with AI Tools](https://facilio.com/developers/docs/script-reference/ai-tools/): Use the llms-full.txt URL directly with ChatGPT, Claude, Lovable, and Cursor ## Introduction - [Introduction to Facilio Script](https://facilio.com/developers/docs/script-reference/index/): Overview of Facilio Script and how it is used. ## Basics - [Data types](https://facilio.com/developers/docs/script-reference/data-types/): Supported data types and how values are represented. - [Variables](https://facilio.com/developers/docs/script-reference/variables/): Variable usage and assignment rules. - [Operators](https://facilio.com/developers/docs/script-reference/operators/): Arithmetic, relational, and logical operators. - [Conditions & Loops](https://facilio.com/developers/docs/script-reference/condition-looping/): Conditional statements and `for each` loops. - [DB params](https://facilio.com/developers/docs/script-reference/dbParam/): Parameters used in database fetch operations. - [System Variables](https://facilio.com/developers/docs/script-reference/system-variables/): Predefined system variables such as current user and organization context. ## Built-in Functions - [Module functions](https://facilio.com/developers/docs/script-reference/module-function/): Fetch, create, update, delete, export, and interact with Facilio modules. - [Criteria function](https://facilio.com/developers/docs/script-reference/criteria-function/): Create, combine, and evaluate criteria for filtering records. - [Reading function](https://facilio.com/developers/docs/script-reference/reading-functions/): Fetch and add readings for sensor or measurement fields. - [Schedule function](https://facilio.com/developers/docs/script-reference/schedule-functions/): Create schedules and calculate next execution times. - [Notification functions](https://facilio.com/developers/docs/script-reference/notification-function/): Send emails, push notifications, and other notifications. - [HTTP functions](https://facilio.com/developers/docs/script-reference/http-function/): Make external GET and POST API calls. - [Connection functions](https://facilio.com/developers/docs/script-reference/connection-function/): Make authenticated API requests through configured connections. - [Map functions](https://facilio.com/developers/docs/script-reference/map-function/): Create and manipulate key-value maps. - [List functions](https://facilio.com/developers/docs/script-reference/list-function/): Create and manipulate lists. - [String functions](https://facilio.com/developers/docs/script-reference/string-function/): Manipulate and process strings. - [Number functions](https://facilio.com/developers/docs/script-reference/number-function/): Convert and format numeric values. - [Math functions](https://facilio.com/developers/docs/script-reference/math-function/): Perform mathematical operations. - [Date-time functions](https://facilio.com/developers/docs/script-reference/date-time-functions/): Work with date and time values. - [CSV functions](https://facilio.com/developers/docs/script-reference/csv-functions/): Build, parse, and convert CSV data. - [XML Builder functions](https://facilio.com/developers/docs/script-reference/xmlBuilder-functions/): Create, parse, and manipulate XML data. - [WorkOrder function](https://facilio.com/developers/docs/script-reference/workorder-functions/): Fetch and analyze work order data. - [Resource Functions](https://facilio.com/developers/docs/script-reference/resource-functions/): Retrieve details of resources such as vendors, visitors, logs, and spaces. - [Field functions](https://facilio.com/developers/docs/script-reference/field-functions/): Retrieve and manipulate field details. - [File functions](https://facilio.com/developers/docs/script-reference/file-functions/): Handle file retrieval, file info, uploads, and downloads. - [Form rule functions](https://facilio.com/developers/docs/script-reference/formrule-functions/): Control form behavior dynamically. - [BusinessHour functions](https://facilio.com/developers/docs/script-reference/businessHour-functions/): Calculate time using defined business hours. - [Controls function](https://facilio.com/developers/docs/script-reference/controls-function/): Control and update device or resource field values. - [Other functions](https://facilio.com/developers/docs/script-reference/other-function/): Miscellaneous utilities such as unit conversion, URL handling, file processing, user info retrieval, and data manipulation.