> For the complete documentation index, see [llms.txt](https://docs.work-relay.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.work-relay.com/forms/best-practices/how-to-get-data-from-any-record.md).

# How to get data from any record

Work-Relay forms allow you to query, display and use data not only from the form's [data source](/forms/basics/how-to-create-a-form.md#select-data-source) record, but also from any other record in the system.

## Pass or capture target record ID

You can capture record ID using different methods:&#x20;

* Parameter: Pass the record ID directly upon form launch via parameters from [process](/forms/using-forms/working-with-parameters-passed-from-the-work-relay-process.md) or [linked](/forms/using-forms/linked-forms.md) form setup. You can access the passed value on the form using `{$FormParameters.myRecord}`.
* Lookup input: Allow the user to select the target record manually via a [Lookup](/forms/form-components/fields/lookup.md) field (e.g., `{$Form.myLookup}`
* Variable: Define the record ID within a [variable](/forms/form-building/variables.md) (e.g., `{$Variables.myVariable}`
* Global Action / Action Group: Call a [global action or group](/forms/form-building/form-action.md#global-action-and-global-action-group-action-types) to fetch the required record ID at runtime. Configire handler actions and use output context (`{$Output.actionVariable}`) in the handler parameters setup screen to use variables that were set during global action execution.&#x20;

## Retrieve record data

Once you have the record ID, choose the appropriate approach based on when the ID becomes available:<br>

* On rorm load (static): if the record ID exists when the form opens (e.g., passed via parameters), use form variables configured with a [SOQL](/automations/functions-and-formulas/functions-library/sobject-functions.md#soql) function to fetch field values immediately.
* At runtime (dynamic): if the record ID is set through user action or form logic (e.g., selected via a Lookup field or retrieved via form event and action), use a [calculate](https://sites.gitbook.com/preview/site_4yKrA/forms/form-building/form-action#calculate) form action with a [SOQL](/automations/functions-and-formulas/functions-library/sobject-functions.md#soql) function to execute the query dynamically at runtime.
