Skip to main content

Hello,

I’m using getVariableByIdAsync API to get a variable info. For example, I try to load a color variable which key is VariableID:d2c9451722738c45a0c75047e467b459856cce94/49352:54

The code will be:

const iconTertiaryVariable = await figma.variables.getVariableByIdAsync(

"VariableID:d2c9451722738c83a0c75047e467b459865cce94/49352:173"

);
If I use the color variable in the figma file already in another element, it works. But If I haven’t used the variable yet in the file, I got error always. It says:
The variable with id "xxxxxxxx" does not exist.
How I can load the variable without this error?

Thanks,

Toshi

See answer here:

 

Also similar topic:

 


@tank666 Thank you!! That’s exactly I was looking for. You made my day.