In this video, we build Action Buttons within the Edit form of a SharePoint List using Lightning Forms. We create an Approval Button and review two other buttons for Generating a Document and Sending the document to an external email.
 
Command Bar Actions
In this section, we will create an example Action that Submits an Expense Claim for approval:
- Click Actions on the command bar within your desired form.
- Choose Command Bar.webp) 
 
- Provide a Display Name such as ‘Submit for Approval’
- Select an icon (note that you can search for an icon. In the below example, we search on the word ‘Send’)
- Optionally configure a Visible Expression or Enabled Expression. An example of a useful expression is: [[@User.IsMemberOfGroup(‘Approvers’)]]. This expression will mean that the button is only visible to Approvers.
- Click Configure Actions.
- Drag the following Actions in Order:- Save Form
- Send internal email
- Show a message
- Close Form.webp)  
 
Action: Loop: apply to each
Loop: apply to each action executes a block of actions for each item in the iterating array.
To configure the action Loop: apply to each additional property should be specified:
 
Configuration
| Property | Required | Type | Description | 
| Iterating array | yes | Array | Need to specify an array or select an output from previous actions. This can be the output of a Get Items action, a variable having an array, a multi lookup field, a multi choice field or just an array directly calculated in this property. | 

Example of Loop: apply to each action configuration with SharePoint list items
Output
| Output Parameter | Type | Description | 
| CurrentItem | Object | Returns an element from the iterating array | 
| Index | Number | Returns an iteration number of element | 
| Count | Number | Returns total iterations number | 
Note: Outputs available for actions inside Loop: apply to each action 
 

For example, you can use the Loop: apply to each action in a situation where you use Get Items to get items that fit a query and want to delete the items that have been retrieved:
Use the Get Items to get the items that fit the query settings > Use a Loop > Within the loop, use the item ID in the Delete Items action as in the image
 

