collection.getVariableByName(name)

Retrieve a variable by its name.

Syntax

1collection.getVariableByName(name: string): Promise<null | Variable>>

Parameters

  • name : string - Name 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 Name
5const variableByName = await collection?.getVariableByName('Space Cadet')
6console.log(variableByName)

Designer Ability

Checks for Authorization only

Designer AbilityLocaleBranchWorkflowSitemode
canReadVariablesAnyAnyAnyAny