Skip to main content

Introduction: What Is a Custom Action Link Field?

A Custom Action Link Field in Frappe Framework v15 allows you to add clickable action links inside a DocType form that execute custom logic instead of opening another document.

Unlike standard Link fields, an Action Link is used to trigger client-side or server-side actions, improving user experience and reducing navigation overhead.

What Is an Action Link Field in Frappe?

An Action Link Field is a Link-type field enhanced with client-side scripting to perform a custom action when clicked.

Key characteristics:

  • Appears as a clickable link in the form
  • Does not redirect to another DocType
  • Executes JavaScript or server calls
  • Fully supported in Desk (v15)

This pattern is commonly used for quick actions like “View Ledger,” “Generate Report,” or “Sync Data.”

When Should You Use an Action Link Field?

Use Action Link Fields when you want contextual actions without cluttering the UI with buttons.

Ideal use cases:

  • Open reports related to the document
  • Trigger background processes
  • Call server-side methods
  • Launch dialogs or confirmations

They provide a clean, inline action mechanism.

How to Create a Custom Action Link Field?

Action Link Fields are created using Custom Fields in the target DocType.

Steps:

  1. Go to Customize Form
  2. Select the target DocType
  3. Add a new field
  4. Set Field Type = Link
  5. Provide a label (e.g., “View Details”)
  6. Save the customization

At this stage, the field is visual only.

How Does an Action Link Work Internally?

The action is handled entirely through Client Script in Frappe v15.

When the link is clicked:

  • Frappe triggers the field’s click event
  • A custom JavaScript handler intercepts the action
  • Your defined logic executes

This keeps the behavior flexible and maintainable.

Implementing an Action Link Using Client Script

Client Scripts are used to bind logic to the Action Link field.

Example: Client Script for Action Link

frappe.ui.form.on('Sales Order', {
custom_action_link: function(frm) {
frappe.msgprint(__('Action link clicked'));
}
});

This script executes when the user clicks the link field.

Triggering Server-Side Logic from Action Link

Action Links can call server-side Python methods using frappe.call.

Example

frappe.ui.form.on('Sales Order', {
custom_action_link: function(frm) {
frappe.call({
method: 'my_app.api.process_order',
args: {
docname: frm.doc.name
}
});
}
});

This pattern is commonly used for validations, integrations, or background jobs.

Best Practices for Action Link Fields

  • Use clear, action-oriented labels
  • Avoid destructive actions without confirmation
  • Keep logic lightweight on click
  • Prefer server-side validation for critical actions
  • Hide links conditionally using frm.toggle_display

These practices ensure usability and safety.

Common UI Patterns Using Action Links

  • “View Related Records”
  • “Generate PDF”
  • “Sync with External System”
  • “Recalculate Values”

Action Links reduce button overload while keeping workflows efficient.

Conditional Display of Action Link Fields

You can dynamically show or hide action links based on document state.

Example:

frm.toggle_display('custom_action_link', frm.doc.docstatus === 1);

This ensures links appear only when relevant.

Advanced Topic: Action Link vs Custom Button

Action Links differ from Custom Buttons in placement and intent.

Feature Action Link Custom Button
UI placement Inline field Form toolbar
Best for Contextual actions Primary actions
Visual weight Lightweight Prominent

Choose based on UX requirements.

Troubleshooting Common Issues

Link not clickable?

  • Ensure field type is Link
  • Check Client Script binding

Action not executed?

  • Verify fieldname in script
  • Check browser console errors

Permission issues?

  • Validate server-side permissions

Industry Relevance

Action Link Fields are widely used in:

  • ERPNext custom workflows
  • Manufacturing dashboards
  • Finance document actions
  • CRM quick navigation

They enable faster, more intuitive operations.

Target Audience

  • Frappe Developers
  • ERPNext Consultants
  • UI/UX Customization Teams
  • System Integrators

Technical Prerequisites

  • Frappe Framework v15
  • Desk module enabled
  • Basic JavaScript knowledge
  • Access to Client Script or Custom App

Official References (Verified)

Official Documentation:

https://docs.frappe.io/framework/user/en/guides/app-development/custom_action_link_field

Frappe GitHub (v15):

https://github.com/frappe/frappe/tree/version-15

Rating: 0 / 5 (0 votes)