Update Record

Overview

The Update Record interaction lets you save changes to a record directly in Salesforce. Unlike the Create interaction, the Update interaction requires a Record ID to identify which record to modify.

This interaction is typically used in two scenarios: saving changes to the record the user is currently viewing (Context Record), or saving changes to a specific record stored in a variable (e.g., a related record fetched via "Get Records").


Configuring the Update Record Interaction

To perform an update, you must identify which Record Variable contains the changes you want to save. The configuration differs slightly depending on whether you are interacting with the main record on the page or a separate dataset.

Method 1: Updating the Current Page Record

Use this method when your Dynamic Component is placed on a Salesforce Record Page (e.g., an Account Record Page) and you want to edit fields belonging to that specific record.

1. Define the Context

  • Open your Dynamic Component's Settings (gear icon ⚙️).

  • Set the Target Page Object to the object you are working on (e.g., Account).

  • Result: This enables the $Component.record variable, which automatically holds the data of the record being viewed.

2. Bind the Fields

  • Open the Fields Tab in the Component Library.

  • Ensure the dropdown at the top of the tab is set to your Target Object.

  • Drag fields onto the canvas.

    • Result: These inputs are automatically bound to $Component.record.FieldName.

3. Configure the Interaction

  • Add an Avonni Button component (e.g., "Save Changes").

  • Add an On Click interaction.

  • Action Type: Select Update Record.

  • Record Variable: Select Target Page Record.

    • Note: This explicitly tells the component to save the data currently held in the $Component.record context.

Method 2: Updating a Specific Record Variable

Use this method when you are editing a record that is not the main record of the page (e.g., updating a related Contact while on an Account page) or when working with data fetched via an "On Load" action.

1. Define and Fetch the Variable

  • Create a Record Variable (e.g., relatedContact).

  • Populate this variable using an On Load > Get Records interaction (or a Flow) to ensure it contains the Record ID and existing data.

2. Bind the Fields

  • Select your variable (e.g., relatedContact) in the variables list.

  • Open the Fields Tab and drag fields onto the canvas.

    • Result: These inputs are bound to {!relatedContact.FieldName}.

3. Configure the Interaction

  • Add an Avonni Button component.

  • Add an On Click interaction.

  • Action Type: Select Update Record.

  • Record Variable: Select your specific variable (e.g., {!relatedContact}).


Important Requirement: The Record ID

For an update to be successful, the Record Variable must contain the Salesforce Record ID.

  • For Method 1 (Context): The system handles this automatically.

  • For Method 2 (Custom Variable): You must ensure that when you fetch the data (via Get Records or Flow), the Id field is included in the query. If the variable lacks an ID, Salesforce will not know which record to update.


Example Scenario: Editing a Case

Goal: A simplified "Resolve Case" panel on the Case Record Page.

Setup (Method 1):

  1. Settings: Target Page Object = Case.

  2. UI: Drag Status, Reason, and Comments from the Fields Tab onto the canvas.

  3. Button: Create a "Save" button.

  4. Interaction: On Click -> Update Record -> Select Target Page Record.

Result: When clicked, the component saves only the changes made to the Case currently being viewed.

Last updated

Was this helpful?