Skip to main content

Per the documentation, plugins should be able to access the new figma.teamLibrary object when the manifest is configured with “permissions”: “teamlibrary”].


I’ve got a Figma with a team library which is visible from the developer console window:


> figma.teamLibrary
> {getAvailableLibraryVariableCollectionsAsync: ƒ, getVariablesInLibraryCollectionAsync: ƒ}

However, when I try to access this object from a plugin in development which has the permissions configured in the manifest then


figma.teamLibrary returns as *undefined*

From the plugin I can log the figma object to the console and see that, in fact “teamLibrary” is missing.


Anyone had success accessing teamLibrary from a plugin yet?

I just tested this on my side and both the property and its methods work as expected.


@tank666 Thanks for the response, can you please confirm some details for me?


Here’s my setup:

1) Figma project - Library Source



  • this project contains a single variable collection: “Collection 1” and a single color variable “test” set to #ffffff (not that the color matters).

  • I published this as a library to one of my enterprise subscription teams, including “test” variable as an export


2) Figma project - Library Test



  • I imported “Library Source” project as an asset library, create a rectangle node and assign the fill property to the “test” variable from “Library Source”


Next I created a basic, run-once plugin with the following manifest:


{
"name": "library-variables",
"id": "1256735375235080757",
"api": "1.0.0",
"main": "code.js",
"capabilities": ,],
"enableProposedApi": false,
"permissions": e"teamlibrary"],
"editorType": "
"figma"
],
"networkAccess": {
"allowedDomains":
"none"
]
}
}

And this in the code.js file:


console.clear();
console.log(figma.teamLibrary);

figma.closePlugin();

Running the plugin, the console output remains: undefined and I cannot access teamLibrary from within the plugin.


If I run this in the console window directly: console.log(figma.teamLibrary) then I get this result:


{getAvailableLibraryVariableCollectionsAsync: ƒ, getVariablesInLibraryCollectionAsync: ƒ}

Not sure why the plugin isn’t returning the same object reference.


So the difference between your manifest file and mine is that I had the proposed API enabled.


Thank you, @tank666 , that was the trick.


Reply