How to Create User Input Prompts for List Actions
Solutions: Lightning List Actions & Lightning Forms
Summary: Learn how to interrupt an action sequence to request user input (e.g., recipient selection) before executing business logic.
Overview
By default, Lightning List Actions execute a pre-defined sequence of steps (e.g., "Send Email", "Update Item") immediately upon clicking a button. However, business scenarios often require the user to provide input or make a selection right before the action runs.
Example Scenario: A user clicks "Send Report" on a list item but needs to choose whether to send it to the "Manager", the "Client", or "Both" before the email triggers.
Note: This solution requires Lightning Forms. While the trigger button is created using Lightning List Actions, the popup dialog interface is designed using Lightning Forms.
To achieve this, we create a specific "Dialog Form" using Lightning Forms.
● It is technically an Edit Form (so it can read the email addresses already on the item).
● It is separate from your default Edit form (so users don't see all the other fields).
● The Action Button opens this specific form in a small panel to collect the input, and the "Confirm" button on this form runs the actual logic.
Implementation Guide
Phase 1: List Setup
First, ensure your list has the data columns containing the email addresses, and create a temporary place to store the user's selection.
1. Navigate to your SharePoint List settings.
2. Prerequisite Data Columns: Ensure you have the columns containing the data you want to use. For this example, create/verify two text columns:
○ ManufacturerEmail1
○ ManufacturerEmail2
3. Create the Selection Column: Create a new column to hold the user's choice.
○ Name: RecipientSelection
○ Type: Choice
○ Choices: Enter options exactly as: Manufacturer 1, Manufacturer 2, Both.
○ Tip: This column does not need to be shown on your default public views.
Phase 2: Lightning Forms
Create a dedicated form view that acts as the popup dialog.
1. Open Lightning Forms on your list.
2. Select Forms > New Form.
3. Form Settings:
○ Name: ActionDialog
○ Type: Edit Form (Must be an Edit form to read the item's current email data).
4. Design the Canvas:
○ Remove all fields from the layout except the RecipientSelection column created in Phase 1.
○ (Optional) Add a Rich Text label with instructions like "Please select a recipient."
5. Save the form (do not close yet).
Phase 3: The 'Confirm' Button
The business logic (e.g., sending the email) moves from the main list button to the button inside this popup.
1. On the ActionDialog design screen, find the Command Bar.
2. Double-click the standard Save button.
3. Rename the button to Confirm or Send.
4. Scroll to Actions and click Configure Actions.
5. Configure the Action Sequence:
○ Step 1: Save Form (Crucial: Commits the user's selection to the item).
○ Step 2: Send Email.
■ To: Use the Expression Builder ({}) to dynamically change the recipient based on the input. Paste the following logic into the assignment section:
=[[RecipientSelection]] == 'Manufacturer 1' ? [[ManufacturerEmail1]] : [[RecipientSelection]] == 'Manufacturer 2' ? [[ManufacturerEmail2]] : [[ManufacturerEmail1]] + ";" + [[ManufacturerEmail2]]
■ Explanation: This logic checks if the user picked "Manufacturer 1". If not, it checks if they picked "Manufacturer 2". If neither (meaning they picked "Both"), it combines both email addresses separated by a semi-colon.
○ Step 3: Close Form.
6. Save & Close the Lightning Forms Designer.
Phase 4: Lightning List Actions
Configure the button on the List View to open your new dialog.
1. Open Lightning List Actions on your list view.
2. Add a new Command Bar Action (e.g., "Share with Manufacturer").
3. General Settings:
○ Selection Type: Single Item (Ensures only one item is processed).
4. Configure Actions:
○ Select Action Type: Open Form.
○ List or Library: Select On Current Site -> Select your current list.
○ Form Type: Edit Form.
○ Form Name: Select the ActionDialog form created in Phase 2.
○ Item ID: Click the expression icon ({}) and enter: [[ID]].
○ Open In: Panel.
○ Panel Width: Medium.
5. Save the Action.
Verification
1. Create a test item with valid email addresses in ManufacturerEmail1 and ManufacturerEmail2.
2. Select that single item in your list view.
3. Click the new Share button.
4. Verify that a side panel opens displaying only the RecipientSelection dropdown.
5. Select "Both" and click Confirm.
6. Verify the panel closes and emails are sent to both addresses defined in the item.
Please feel free to contact [email protected] if you have any further questions, as we’re more than happy to help.