frappe-syntax-clientscripts

Write Frappe client scripts for form events, child tables, and server calls.

163|53|Updated Jan 14, 2026
One-click install
npx skills add https://github.com/Impertio-Studio/Frappe_Claude_Skill_Package --skill frappe-syntax-clientscripts-impertio-studio
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: frappe-syntax-clientscripts
Source: https://github.com/Impertio-Studio/Frappe_Claude_Skill_Package/tree/main/skills/source/syntax/frappe-syntax-clientscripts
Command: npx skills add https://github.com/Impertio-Studio/Frappe_Claude_Skill_Package --skill frappe-syntax-clientscripts-impertio-studio

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Client-side Frappe code often looks correct but breaks in real forms because it uses the wrong APIs, registers events in the wrong lifecycle hooks, or mishandles child tables and server calls. This Skill helps you write correct, maintainable client scripts that behave reliably across form states in ERPNext/Frappe.

Core Features & Use Cases

  • Correct form event lifecycle usage: Registers handlers using the right events like setup, refresh, validate, and onload_post_render, with an explicit decision tree.
  • Safe value manipulation patterns: Uses frm.set_value() and read-only frm.doc access instead of direct assignments that bypass dirty flags and change triggers.
  • Reliable child table updates: Ensures child table modifications are followed by frm.refresh_field() and uses child-doctype event context with cdt/cdn.
  • Link field filtering done right: Places frm.set_query() in setup so filters are registered once and remain consistent.
  • Hardened server communication: Shows how to call whitelisted methods via frappe.call() and document controller methods via frm.call(), with guardrails like checking r.message.

Quick Start

Write a client script for the Sales Order form that updates an item's amount when qty or rate changes, filters customers by disabled status, and prevents saving with frappe.throw() when a custom validation fails.

Frequently Asked Questions about frappe-syntax-clientscripts

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write a Frappe client script that updates child table fields without breaking the form?

To update Frappe child tables safely, modify the row data and call frm.refresh_field() on the child table. Use cdt and cdn parameters in child doctype event handlers to ensure correct context and prevent form state issues.

What is the correct lifecycle event in ERPNext to register Link field filters?

The correct lifecycle event to register Link field filters in ERPNext is the setup event. Placing frm.set_query() inside setup ensures filters are registered once and remain consistent across form refreshes and renders.

How do I block form validation in a Frappe client script when a custom condition fails?

To block validation in a Frappe client script, call frappe.throw() with an error message inside the validate event. This stops the save process and alerts the user to the unmet validation requirement immediately.

Why does my frappe.call server response return undefined data in my client script?

A frappe.call server response returns undefined data when you fail to check the r.message object. Frappe wraps whitelisted method responses in r.message, so always verify r.message exists before processing the returned data.

Does this approach to Frappe client scripts work across ERPNext version 14 to 16?

Yes, this approach to Frappe client scripts works across ERPNext version 14 to 16. It ensures event lifecycle correctness and safe value handling using APIs compatible with Frappe v14 through v16 form events.