Linked Record Actions
Linked Record actions provide a way to copy information from one record into linked records that are one or more levels away. To do so, the action takes values from the current record and inputs them into one or more records that are linked through field relationships.
Linked record actions are used as containers for other actions, particularly Update Field actions, allowing direct access to fields that are linked through several levels of relationships. It's possible to update linked records using a normal Update Fields action, but in that case the update must be a fixed value or variable from the record being updated; the action can't copy a value from the current record. Linked Record actions can copy a value, such as the record ID, from the current record into linked records three levels away without creating intermediary linked fields, which triggers a relationship between those records that did not previously exist.
This allows you to pass values directly from the parent table for updating, which is not possible with an Update Field action. In other words, the table from which the action is running can use its own values in the linked field. In the Formula Help wizard for actions that are contained by a Linked Record action, the Parent Fields tab contains values from the current table, as well as values that belong to other tables in the chain of linked fields.
The Approvals table contains a linked field set to the Contracts table. This linked field set is used to create the "Set Contract Status to Pending Approval LR" Linked Record action in the Approvals table.
On the Actions tab of the Linked Record Action wizard, clicking the Contract table in the chain shows the "Set Status to Pending Approval" Update Fields action. When triggered, this action sets the status of the linked Contract record to Pending Approval.
When the status changes to Pending Approval, the "All Contract Approval Edit Actions" If-Then-Else action in the Approvals table runs a series of further actions related to the Approval.
Linked Record actions are also commonly used to:
- Run an Email action from the other table to addresses held in that table that includes field values from the parent table.
- Run an If-Then-Else action to apply other conditions before updating a subset of the found records.
For more information on the capabilities of this action type, see Updating Linked Records.
Create a Linked Record Action
You can find the Actions wizard via several paths, but the easiest is to start by clicking Setup [Table Name] for the table where you wish to create your action.
- Select the Actions tab in the Table wizard.
- Click Create Linked Record Action.
On the General tab, name your action and give it a description.
Once your action is saved the system automatically adds an L: before your given title to distinguish the action as Linked Record.
- Navigate to the Chain tab and select a linked field you want to update. The top drop-down menu contains active links, or relationships in which the current record pulls in one or more records from another table. The bottom drop-down menu contains passive links, or relationships in which records in another table have a link to one or more records in the current table.
In most cases, choosing a linked relationship from the top drop-down menu will update a single linked record, while choosing a “referring” item such as a related table will update multiple records that have been linked to the current record.
- Navigate to the Actions tab and select the table hyperlink above the drop-down menu where you would like to perform your actions and, if desired, choose a saved search to filter the records.
- Click Add Action to choose the actions to be executed on the found records. You can either select an existing action or create a new one. Actions may include any action type but are generally limited to If-Then-Else, Update Fields, and Email actions.
- Click Finish.
Let's take a look at two extended use cases to demonstrate how a Linked Record action may be used.
Linking a Service Request to a User Record
In this example, suppose that you want each user record in the People table to show the last completed service request that the user submitted. To do so, you create a Linked Record action in the Service Requests table that adds the service request ID to the Last Completed Service Request field in the submitter's user record whenever one of the user's service requests is closed. You can initiate the Linked Record action with an action button, or a rule that closes the service request.
Selecting the Table with the Linked Field
Assume that you've already created the Last Completed Service Request linked field. On the Chain tab of the Linked Record action wizard, select the table with the linked field that points to the Service Requests table. In this case, it's the People table and the field we just mentioned.
Remember, the top drop-down list contains active links, or linked fields in the current table pointing to another table. The bottom drop-down list contains passive links, or linked fields in other tables that point to the current table.
Viewing the Relationship Chain
After making the above selection, the wizard displays a relationship chain. The chain shows the parent table, Service Requests, the current table, People, the selected linked fields, and the direction of the link.
Each time you select a linked relationship, both drop-down menus are updated with new linked relationships based on your selection. This allows you to work your way down through those links to the target table.
Emailing the Submitter's Department Head
Suppose you also want to email the submitter's department head that the service request was completed. Use the bottom drop-down list to select the linked set in the Department table that includes the Department Head field. When you do so, see that the relationship chain grows.
On the Actions tab, notice the relationship chain and select each table in the chain to define an action to run at that level. After selecting the People table, create an Update Fields action to populate the Last Completed Service Request field with the service request ID. You can also select the Department table and create an Email action to email the department head that the service request has been completed, including the service request ID in the email.
Using the Formula Wizard
When creating your Update Fields action, you can select the option on the Values tab to treat the new values as a formula. This lets you use the Formula wizard to insert values from the current record. With the Email action, you can directly click Formula Help in the email template to do the same.
Once in the Formula wizard, navigate to the Parent Fields tab to see a list of fields from the parent table, which is the Service Requests table in this example. To insert the service request ID, click the appropriate variable name.
Using the Linked Record Action
Finally, you can create an action button or a rule in the Service Requests table that closes the service request and runs the Linked Record action. The Linked Record action then updates the Last Completed Service Request linked field in the People table with the Service Request ID value from the current service request. It also runs the Email action from the Department table and uses the Service Request ID value from the current service request.
Generating Approvals Based on a Workflow
This use case is a real example from the Contracts table, and it's slightly more involved than the previous use case. When a contract needs approvals from other users, a user can click a Create Approvals action button to generate approval records based on the approval workflow associated with the contract. The approval workflow is the set of approvals a contract must go through before the contract is formally approved. For each approval, a record is generated that allows the appropriate user to approve or reject the contract at that stage in the approval workflow.
Using the Create Approvals Button
The Create Approvals action button contains an If-Then-Else action that checks to see if the contract has a Workflow ID. The Workflow ID field in a Contract record is a linked field that links to the Approval Workflows table, which contains the set of approval workflows for each contract type. Depending on the Workflow ID, the contract goes through a specific approval workflow based on the contract type.
When a user clicks the Create Approvals action button and the If-Then-Else action finds that a Workflow ID has not been defined for the contract, it runs a Validate action with an error message. Otherwise, if the Workflow ID has been defined, it runs a Linked Record action.
Selecting the Table with the Linked Field
When creating the above Linked Record action in the Contracts table, first create a chain to the Approval Workflows table using the Workflow ID field. In the Linked Record action wizard, select that field and table from the top drop-down list on the Chain tab. Remember, the top drop-down list contains linked fields in the current table that point to another table.
This begins the chain and creates the relationship to the Approval Workflows table. This step is necessary because this relationship allows you to create a further relationship to the Approval Templates table, which you do next.
The Approval Templates table is the table from which new approval records are generated. You need to make sure the correct approvals are generated for the contract type and that they're linked to the current contract. The Approval Templates table also contains its own Workflow ID field, and this field links to the Approval Workflows table, allowing you to create the relationship chain you need.
Selecting the Next Table with the Linked Field
Instead of the top drop-down menu, this time you use the bottom drop-down menu because the linked relationship goes in the other direction: the Workflow ID field in the Approval Templates table links to the Approval Workflows table, the current table. As might be obvious, you choose the Approval Templates table with the linked field set containing the Workflow ID field from the list.
Selecting a Saved Search
Now that you have your chain of linked records, you could add the action that starts the approvals process. However, in this case it's better to first create a saved search to return only approval records that have an Active status. You don't want to generate approvals that are inactive.
Adding an Update Fields Action
After selecting the saved search, create and add an Update Fields action to the Linked Record action. When the Create Approvals action button that we discussed earlier is clicked, this action runs on the Approval Templates table so that a rule can ultimately generate the approvals. The action updates two fields. It pushes the contract ID from the current contract into the Latest Contract ID field in the approval templates that make up the approval workflow. This links those approval templates to the current contract.
Remember, to use a value from the current record, select a variable from the Parent Fields tab of the Formula wizard. In this case, that variable is "$contract.id," which gets its value from the contract's ID field.
The other field the Update Fields action updates is the Trigger Approval Creation field, which it changes to Yes. This field, as the name suggests, acts as a trigger that a rule uses to generate the approval records by using a Conversion action.