Lightning Forms – Creating Actions – Command Bar Buttons

In this video, we build Action Buttons within the Edit form of a SharePoint List using Lightning Forms. We create an Approval Button, along with a review of 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:

  1. Click Actions on the command bar within your desired form.
  2. Choose Command Bar
  • 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


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

PropertyRequiredTypeDescription
Iterating array
yesArrayNeed 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
TypeDescription
CurrentItemObjectReturns an element from the iterating array 

IndexNumberReturns an iteration number of element

CountNumberReturns 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

Related Posts
Clear Filters

Add Comment