Table of Contents
Using Action Links
Updated
by Lesley
What are Action Links?
Action Links are a special type of link that you can add to details, grids, searches, lists, maps, or calendar views that trigger actions. These links allow your Live App users to add links to edit, view more details or trigger specific actions behind the scenes.
Action Links can be found in any of the specified views, under the "Columns" or “Details” section of view settings when editing a view. Here is an example of what an action link looks like in a grid view. These links give the options to edit, view or trigger an action to approve a record.
With Action Links you can perform the following actions:
- Edit the record
- View record details
- Delete a record
- Link to another page
- Trigger an action like updating or inserting a connected record or sending an email.
Here are some common examples of how Action Links are used:
- 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 add an action link, navigate to the "Pages" section of your Knack Builder, and select a compatible view (details, table, search, list, map or calendar views) and open the view editor.
Each view has a slight variation on how to add action links. In this example we will walk through adding an action link to a grid view.
Adding Action Links to Grid Views
Once the view editor is open in the toolbox, select the “Columns" section and then select the “Actions” tab.
There you will have the option to add links to:
- Edit the record: this will add a new edit form to edit the individual record
- View record details: this will add a new details view to view the individual record
- Delete a record: this will delete the record from the app
- Link to another page: this will allow you to select another page in your app to link to
- Trigger an action: this will allow you to define a specific action that will be executed when the link is clicked, like updating or inserting a connected record or sending an email.
Each of these options are outlined below.
Edit Action Links
To edit an existing action link, open the view editor and select the pencil icon on the action link in the page preview.
This will open the action link settings in the toolbox to the left with varying options depending on the type of action.
Read more on action link settings in the sections outlined below.
Delete Action Links
To delete an action link from the view, open the view editor and select the trash can icon on the action link in the view preview.
Action Link Settings
Depending on the type of action link used there will be variations to the settings available. Similarly depending on the view type you may see other options when editing the field that are not specific to the action link settings.
To edit an existing link, click on the field in the view preview and the toolbox will reveal settings specific to that action link type.
Edit Record, View Record Details and Link to Another Page
Using an action link you can link to edit a record, view record details or link to another page will link to another page within your app:
- For edit and view record details the link will generate a new child page with an edit form to edit the record or details view to view the record.
- The link to another page options will prompt you to select an existing page with views which share the same source table as the original table.
Settings
The following options available for these types of links:
- Page to link to: displays the page which the link links to
- Link Type: defines if the link will display custom text or use a field value form the record.
- Link Text: custom text for the link
- Link Field: the field value which will be used as the link text
- Icon: display an icon alongside the link
Delete a Record
Using an action link to delete a record will add a link directly to the view. If the link is clicked this will prompt the user to confirm and then delete the record from the app.
Settings
The following options are available for delete links:
- Link Type: defines if the link will display custom text or use a field value form the record.
- Link Text: custom text for the link
- Link Field: the field value which will be used as the link text
- Icon: display an icon alongside the link
Trigger an Action
The trigger an action option will allow you to perform actions behind the scenes such as approving a connected record or emailing a user.
- Link Text: The link text used to trigger the action.
- Criteria: defined criteria which will control how the action link is executed when the link is clicked.
- Actions: the actions that are triggered when the link is clicked.
- Outcome: what happens after the action completes, such as showing a message or redirecting the user.
Link Text
This is the text which will appear as the action link. So for example, if you had an active link to update a record to approved, you could set the link text as “Approve”.
Criteria
This section defines the criteria for when the action is actually triggered after the link is clicked. When the link is clicked and all the criteria are met, the action will run.
By default the rule is set to run for every action link click, however, you can add criteria based on one or more specific record values.
For example, if you only want the action link to work on records with a date older than the current date.
Actions
The actions define what Knack will do behind the scenes once the action link has been clicked.
The following actions are available to use:
- Update this record
- Update a connected record
- Insert a connected record
- Send a custom email
Action: Update this record
This option will update the record this link is added to. This is useful for setting status or workflow fields upon click. You can also assign logged-in users so you can track who triggered this action.
For 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 will update connected records for the record this link is added to. Your record's table must be connected to at least one other table for this option to be available.
For 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 option will insert a connected record to the record this link is added to. Your record's table must be connected to at least one other table for this option to be available. This option is great for adding history, version, and archived records based on the action link click.
For example:
- 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 option will send an email for the record this link is added to. You can use record values for custom recipients, subjects, and messages.
For 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.
Values
The "Values" section of action links allow you to choose which fields are updated by the actions. Here you can add multiple value settings by selecting the green “+” button, or remove the settings by selecting the red “-” button.
Values can be set to:
- A connected value: choose a field from a record connected to the form record
- 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 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 whatever values are selected in the action when the action 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.
Outcome
The outcome section defines what happens after an action link is successfully triggered. This is often a crucial piece of setting up the workflow, as you can redirect a user from one page to another or show a particular message.
Options here include:
- Show a confirmation message: this will display a message in the top right corner of the Live App
- Redirect to an existing page: this will redirect to another page within the app which you choose
- Redirect to the parent page: this will redirect to the current page’s parent page
- Redirect to another website's URL: this will redirect to an external page of your choice
- Redirect to a new child page: this will generate a new child page to redirect to
Notes & Troubleshooting
- Use caution when using the 'update connected records" option and deciding where to offer this for users in your app. This allows for updates to be made to multiple connected records at once, rather than single records.
- Only one action link is allowed per table cell. If multiple options are required for a record, multiple action links will need to be added.