Configuring Button Checkboxes for Bulk Actions in Entity Lists

    Configuring Button Checkboxes for Bulk Actions in Entity Lists

    In Magentrix, you can enable Button Checkboxes on entity list buttons to allow users to perform actions on multiple records simultaneously. When enabled, a checkbox appears next to each record in the list. When a user selects records and clicks the button, the action is applied only to those specific selections.

    Configuration varies depending on whether your button content type is URL or JavaScript.


    Content Type: URL

    When using the URL content type, the selected record IDs are sent via an HTTP POST request to your specified endpoint. The payload will contain a parameter named recordIds containing an array of the selected IDs.

    C# / Controller Example:

    [HttpPost]
    public ActionResponse UpdateStatus(string[] recordIds)
    {
        // Logic to process the selected record IDs
        ...
    }
    

    Content Type: JavaScript

    If your button triggers JavaScript, you can programmatically access the IDs of the records selected by the user. Magentrix provides a specific token, GETRECORDIDS(), to retrieve this array.

    JavaScript Example:

    Use the following syntax to pass selected IDs into your script:

    // Retrieve the array of selected Record IDs
    var ids = {GETRECORDIDS()};
    
    // Example: Alert the number of selected records
    alert("You have selected " + ids.length + " records.");
    

    Best Practices for Implementation

    • Validation: Always include a check in your JavaScript to ensure ids.length > 0 before processing to avoid errors when no records are selected.

    • Security: Ensure your POST endpoint validates that the current user has the appropriate permissions to modify the records sent in the recordIds array.

    • User Experience: Use checkboxes for bulk status updates, mass deletions, or exporting specific data sets to external systems.

    « Previous Article


    3.0 (10)


    Comments

    No records to display

    Subscription
    Follow Knowledge posts
    Please enter your email address to subscribe:

    Email:
    Subscribe