collection.getVariable(id)

Retrieve a variable by its ID.

Syntax

1collection.getVariable(id: VariableId): Promise<null | Variable>

Parameters

  • ID : string - ID of the variable you’d like to retrieve

Returns

Promise<Variable | null>

A promise that resolves to a Variable object, or null if not found

Example

1// Get Collection
2const collection = await webflow.getDefaultVariableCollection()
3
4// Get variable by ID
5const variableById = await collection?.getVariable('id-123')
6console.log(variableById)

Designer Ability

Checks for Authorization only

Designer AbilityLocaleBranchWorkflowSitemode
canReadVariablesAnyAnyAnyAny