Client Script
Overview
Client Script — Business-Focused Explanation
The Client Script document is used in Dafater to customize how users interact with forms and screens during their daily work. It allows businesses to adjust on-screen behavior so that data entry becomes faster, more accurate, and aligned with internal policies—without changing the core system processes.
What the Client Script is Used For in Business Operations
The Client Script helps businesses control and improve user experience at the point of data entry. It is used to:
- Guide users while filling forms by automatically setting values or showing helpful messages
- Enforce business rules instantly before records are saved
- Reduce errors by preventing incorrect or incomplete information
- Simplify complex forms by hiding or showing fields when needed
In short, it ensures that employees follow business rules naturally as they work, rather than relying on training or manual checks.
Prerequisites or Setup Requirements
Before using Client Script, the following should be in place:
- The relevant business document (such as an order, request, or record) must already exist in Dafater
- Business rules and form behavior expectations should be clearly defined
- Only authorized users with system configuration responsibility should create or modify Client Scripts
- Testing should be planned to confirm that changes support operations without disrupting users
Typical Workflow and How It Fits into Business Processes
Identify a Business Need
For example, users frequently enter incorrect data, miss mandatory fields, or require guidance.Define the Desired Behavior
Decide what should happen on the screen—such as auto-filling values, warnings, or field restrictions.Create a Client Script
The Client Script is linked to a specific document so the behavior applies consistently.Test with Business Users
Ensure the form behaves as expected and supports daily operations.Deploy and Monitor
Once active, the Client Script becomes part of the normal workflow, improving efficiency and compliance.
Key Business Scenarios Where Client Script Is Essential
Data Accuracy Control
Prevent users from saving records unless required business information is provided.Process Compliance
Enforce internal policies directly on forms, such as approval conditions or mandatory remarks.Operational Efficiency
Automatically set values based on selections, reducing repetitive manual entry.User Guidance
Display clear prompts or warnings when users make selections that impact downstream processes.Form Simplification
Show only relevant fields based on the transaction type or business context.
Important Considerations for Users
- Changes affect all users working with the selected document, so scripts should be well thought out
- Overuse can make forms confusing instead of helpful—simplicity is key
- Business teams should document why each Client Script exists for future reference
- Regular reviews are recommended to ensure scripts still match current business rules
- Any change should be tested before being used in live operations
Summary
The Client Script is a powerful business tool in Dafater that shapes how users interact with forms. By embedding business logic directly into daily workflows, it improves data quality, enforces policies, and enhances user productivity—making it an essential component for organizations aiming for consistency and operational excellence.
Adds a custom client script to a DocType
Basic Information
- Module: Custom
- Document Type: Document
Fields
| Field Name | Label | Type | Required | Options | Description |
|---|---|---|---|---|---|
| dt | DocType | Link | ✓ | DocType | Target DocType where Dafater client script executes. |
| view | Apply To | Select | List, Form | Defines Dafater view where the script applies. | |
| module | Module (for export) | Link | Module Def | Module used for exporting this Dafater client script. | |
| enabled | Enabled | Check | - | Enable or disable this Dafater client script. | |
| script | Script | Code | JS | JavaScript logic executed on the Dafater client side. | |
| sample | Sample | HTML | - | Reference example to understand Dafater client script usage. |
Permissions
| Role | Read | Write | Create | Delete | Submit | Cancel |
|---|---|---|---|---|---|---|
| System Manager | ✓ | ✓ | ✓ | ✓ | ||
| Administrator | ✓ | ✓ | ✓ | ✓ |
Related DocTypes
| DocType | Relationship | Module |
|---|---|---|
| Module Def | Links to | Core |