This article will guide you on how to effectively use Knack's Action Links to integrate them into your views.
What are Action Links?
Action Links are a unique type of link that can be incorporated into details, grids, searches, lists, maps, or calendar views to initiate various actions. These links empower Live App users to easily access options such as editing, viewing more details, or triggering specific actions in the background.
Action Links are located in the designated views, specifically in the "Columns" or "Details" section of the view settings during the editing process. To provide a visual representation, below is an example of an action link in a grid view.
These links offer choices to edit, view, or trigger an action to approve a record:
With Action Links, you have the power to perform a variety of actions:
Edit the record
View record details
Delete a record
Link to another page
Trigger an action such as updating or inserting a connected record or sending an email
Here are a few practical examples of how Action Links can be utilized:
Change the status of a record to "completed" and set the time that action was taken
Update a record's assignment to the logged-in user
Approve a record and send an email of this approval
Manage Action Links
Add Action Links
To incorporate an action link, simply navigate to the "Pages" section of your Knack Builder. From there, select the appropriate view (details, table, search, list, map, or calendar views) and open the view editor.
Each view type has a small variation in how action links are added. Let's go through the process of adding an action link to a grid view as an example.
For grid views, you can access action links from the “Add Columns” section of the settings. For all other views, action links will be under the respective “Details” sections of the view settings.
Adding Action Links to Grid Views
To add action links, open the view editor in the toolbox and go to the "Add Columns" section. Then, click on the "Actions" tab.
You will find a variety of options to add links to:
- Edit record: This option will add a new edit form to make changes to the individual record.
- View record details: This action will add a new Details view and enable users to access a detailed view of the individual record.
- Delete record: This action will permanently remove the record from the application/database.
- Link to another page: This action provides the ability to select a different page within your application to establish a link with.
- Trigger an action: This feature enables you to specify a particular action that will occur when the link is clicked, such as updating or inserting a connected record, or sending an email.
Below, we have outlined each of these options for you to explore further.
Edit Action Links
To make changes to an existing action link, simply open the view editor and click on the pencil icon located on the action link column in the page preview.
This will open the action link settings in the toolbox on the left side, offering a range of options based on the type of action.
For more information on action link settings, please refer to the sections outlined below.
Delete Action Links
To remove an action link from the view, simply open the view editor and click on the trash can icon located on the action link column in the view preview.
Please note that once an action link is deleted, it cannot be restored. If you delete an action link that is linked to an edit or view more details action, the associated child page will also be deleted unless it is linked to from another part of your application.
Action Link Settings
The settings available may vary depending on the type of action link used. Additionally, when editing the field, you may encounter other options that are not specifically related to the action link settings, depending on the view type.
To modify an existing link, simply click on the field in the view preview. The toolbox will then display settings that are specific to the type of action link.
Edit Record, View Record Details, and Link to Another Page Action Links
By utilizing an action link, you have the ability to easily navigate to edit a record, view record details, or link to another page within your app:
- For Edit record and View record details, the link will create a new child page with an Edit Form for modifying the record or a Details view for reviewing the record's details.
- For Link to another page, you will be prompted to select an existing page that has views sharing the same source table as the original table.
Here are the available options for these types of links:
- Page to link to: Displays the page to which the link navigates to.
- Link Type: Specifies whether the link will show customized text or utilize a value from a field in the record.
- Text: Custom text for the link
- Field: Field value which will be used as the link text
- Icon: Include an icon next to the link.
Display Rules: Add rules to update the column's display.
Design: Adjust the column width and the alignment of the column.
Link Design: Allows you to utilize custom design settings.
Delete a Record
When utilizing an action link to delete a record, a link will be added directly to the view. If the user clicks on the link, they will be prompted to confirm before the record is permanently deleted from the application.
The same settings as the above section apply for this action link type in the Column Properties.
Trigger an Action
The trigger an action feature enables you to easily perform actions in the background, such as approving a connected record or sending an email to a user.
- Link Text: The link text used to trigger the action.
- Criteria: Criteria that you define will control how the action link is executed when it is clicked.
- Actions: The actions that are triggered when the link is clicked.
- Outcome: The outcome after the action is completed, such as displaying a message or redirecting the user.
This is the text that will appear as the action link. For example, if you have a link that updates a record to approved, you can set the link text as "Approve".
This section outlines the conditions that must be met for the action to be triggered after the link is clicked. If all the criteria are satisfied, the action will be executed.
The default setting for the rule is to execute for every action link click. However, you have the option to add criteria based on one or more specific record values.
For instance, if you prefer the action link to only function on records that have a date earlier than the current date, you could implement that by selecting "Add criteria".
If you add multiple conditions, all conditions must be met in order for the action to be executed.
The actions define what Knack will do behind the scenes once the action link has been clicked.
Here are the actions you can choose from:
- Update this record
- Update a connected record
- Insert a connected record
- Send a custom email
Action: Update this record
This feature allows you to update the record to which this link is added to. It comes in handy for configuring status or workflow fields with just a click.
Additionally, you have the ability to assign logged-in users, enabling you to easily track who initiated this action.
Example:Set up an "Assign to me" link that sets an Assigned Date to the current date, changes a Status field to "assigned", and set the assignee to the logged-in user.
Action: Update connected records
This option enables the update of connected records for the record to which this link is added to. To utilize this option, your record's table must be connected to at least one other table.
Example:On a "confirm order" action link, when the status of an order is "confirmed", update the status field on the connected line items table to "confirmed" as well
Action: Insert a connected record
This feature allows you to add a connected record to the record that this link is added to. To utilize this option, your record's table must be connected to at least one other table.
This option is valuable for including historical, versioning, and archived records based on the action link click.
Upon clicking an "archive" action link, which sets the status field on a record to "archived", insert a new connected record of the same table with all of the same data, where the connection is called Record history entry.
This way, you can track each change to the parent record with a separate record.
Action: Send a custom email
This feature allows you to send an email for the record to which this link is added to. You have the flexibility to use record values to customize the recipients, subjects, and messages of the email.
Example:Using values from the Purchase Order record, this action link will notify the purchasing department which Purchase Order record's status has been set to "needs approval."
You can learn more about sending emails in Knack here.
In the "Values" section of action links, you have the ability to select the fields that will be updated by the actions. Simply click on the green "+" button to add multiple value settings, or click on the red "-" button to remove any settings.
Values can be set to:
- To a connected value: Choose a field from a record connected to the form record.
- To a custom value: This allows you to either:
- Enter a value manually.
- Or, you can append or remove values for multiple choice fields or connection fields without overwriting the existing values. (See details on appending/removing multiple values below.)
- To the logged-in User: For user connection fields on pages which require a login
- To the current date: For date fields only
- To the user's current location: For address fields only when the user is logged in
Append/Remove Multiple Values
When using multiple choice fields or "many" connection fields with record rules, you can use the custom value option to either, replace, append or remove values from the field.
To use this option, select the "to a custom value" option in the "Values" section while building your action link. This will give you three options:
- By replacing with: This option will replace the current field value with the selected values when the action is triggered.
- By adding: This option will append the value(s) selected in the action to any existing values in the field when the action is triggered.
- By removing: This option will remove the value selected in the action if it exists in the field when the action is triggered.
The outcome section determines the subsequent actions following the successful triggering of an action link. This is a vital component in configuring the workflow, as it allows for the redirection of users to different pages or the display of specific messages.
Options here include:
- Show a confirmation message: This will show a message in the upper right corner of the Live App.
- Redirect to an existing page: This will direct you to another page within your app that you can choose.
- Redirect to the parent page: This will redirect to the parent page of the current page.
- Redirect to another website's URL: This option allows you to redirect to an external webpage of your choosing.
- Redirect to a new child page: This option will create a brand new child page for the redirection.
These follow all of the same setup and options as submit rules, with the exception that the confirmation messages with action links show up as notifications in the upper right-hand corner of the Live App.
Notes & Troubleshooting
Exercise caution when utilizing the "update connected records" option and determining where to provide this functionality to users in your app. This feature allows for simultaneous updates to multiple connected records instead of just single records.
To provide multiple options for a record, you can add multiple action links. However, please note that only one action link is allowed per table cell.