Skip to main content
Question

Unique file identifier

  • October 19, 2022
  • 4 replies
  • 903 views

Thomas_Kliszowski

👋 there

I need to keep some Figma layers in sync with my tool layers.
To achieve that, I store Figma layer ids in my tool to do an update in case of re-sync.

The thing is : I can’t uniquely identify a layer from its id since two files could have the same layer id.
Is there a way to have a unique file identifier? I know the fileKey could do the job, but my plugin is certainly not a private one. Note that I don’t need the exact fileKey, knowing that one file is not that same as another is enough.

Thank you!

Thomas_Kliszowski

For the record: I tried putting a custom id on figma.root using setPluginData. It works, but duplicating the file also duplicates this id, thus I can’t achieve unique identification this way.


tank666
  • October 19, 2022

Will you be publishing the plugin to the Figma Community (if not already published) or are you developing the plugin just for yourself?

If the former, then you need to come up with something, such as asking the user to paste a link to a file in order to get a fileKey. If the latter, then enable the private plugin API in the manifest.json file and use the figma.fileKey.


Thomas_Kliszowski

The plugin is indeed published to the Figma Community.

Thank you for your solution, but asking the user for the link to the file he is already on, I am afraid that the user experience will be pretty bad.


tank666
  • October 19, 2022

Unfortunately, I don’t see any other way.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings