Skip to main content

Custom List Actions

Custom List Actions allow you to add custom actions directly to the list view of Frappe CRM masters such as Leads, Deals, and Organizations. These actions help users perform tasks quickly without opening individual records.

Similar to Custom Actions on individual records, Custom List Actions can be used to automate repetitive tasks, update multiple records, or execute custom workflows directly from the list view.

Tip

Use Custom List Actions for tasks that are frequently performed on multiple records. This reduces manual effort and improves productivity for sales teams.

Types of List Actions

Frappe CRM provides two main types of Custom List Actions:

  • Actions — Perform tasks directly from the list view header.
  • Bulk Actions — Apply actions to multiple selected records at once.

Actions

Actions work similarly to Custom Actions available on individual Lead or Deal pages. They appear as buttons in the list view header beside the create button.

You can create different types of actions, including:

  • Normal buttons.
  • Grouped actions.
  • Grouped actions with labels.
  • Combination of multiple action types.

For example, you can create a Delete Junk Deals button that automatically removes all Deals marked as Junk directly from the list view.

Bulk Actions

Bulk Actions allow users to perform the same operation on multiple selected records simultaneously.

These actions are useful when you need to update, process, or manage a group of Leads or Deals together.

Example: Mark Multiple Deals as Won

The following example updates the status of selected Deals to Won.


{
  "label": "Mark Won",
  "onClick": async ({ list, selections, unselectAll, call }) => {

    let docs = Array.from(selections)

    for (const doc of docs) {

      await call('frappe.client.set_value', {
        doctype: 'CRM Deal',
        name: doc,
        fieldname: 'status',
        value: 'Won',
      })

    }

    unselectAll()
    list.reload()

  }
}

In this example:

  • selections contains the names of all selected records.
  • The call method updates each record’s status.
  • unselectAll() removes the selected rows.
  • list.reload() refreshes the list view with updated data.

Adding Custom List Actions

Custom List Actions are created using CRM Form Script. Follow these steps to configure them:

  1. Open CRM Form Script
    Navigate to Desk and open CRM Form Script.
  2. Select Doctype and Apply To
    Choose the required DocType, such as Lead, Deal, or Customer. In the Apply To field, select List and save the configuration.
  3. Define Actions
    The generated script provides two sections:

    • actions — Creates buttons displayed in the list view header. These work similarly to Custom Actions on individual records.
    • bulk_actions — Creates buttons that operate on selected rows in the list view.
  4. Use List Context
    Actions can use JavaScript logic and access the list view context to perform operations such as refreshing data or interacting with selected records.

Available Context

Custom List Actions provide additional context objects that can be used inside your scripts, including list controls, dialogs, navigation, notifications, and server calls.

List Action Context

When creating Custom List Actions, you can access the following context objects:

  • list — Provides access to the current list view. You can use methods such as list.reload() to refresh records.
  • call — Allows you to execute server-side methods.
  • router — Enables navigation to different pages.
  • $dialog — Provides dialog-related functionality.
  • createToast — Displays notifications to users.

Bulk Action Context

Bulk Actions receive additional context values because they operate on selected records.

Available Parameters

  • selections — A Set object containing the names of all selected records in the list view.
  • unselectAll — A function used to remove all selected rows after completing the action.

Common Uses for Custom List Actions

Custom List Actions can help automate many repetitive operations, including:

  • Updating statuses for multiple Leads or Deals.
  • Sending bulk emails or notifications.
  • Exporting selected records for analysis.
  • Triggering approval workflows.
  • Running custom business processes.
  • Performing bulk record updates.

Best Practices

  • Create List Actions only for frequently performed operations.
  • Use clear button labels that explain the action being performed.
  • Add confirmation dialogs before making major changes.
  • Use Bulk Actions carefully to avoid accidental updates to multiple records.
  • Test custom scripts before applying them to production workflows.

Note

Custom List Actions use CRM Form Scripts and JavaScript logic. Ensure users understand the impact of bulk operations before enabling them in production environments.

Rating: 0 / 5 (0 votes)