getting parent item in a group library

Hello,
API question


I'm writing a plugin with code similar to the following. It works when I have a pdf selected on my personal 'My library' subcollection, but when I use it on something selected in a subcollection in my 'group library' I get errors like:

Is there something obvious that I'm doing wrong here?

Thanks!


[JavaScript Error: "Parent item 1/4Q5DY97J not found" {file: "chrome://zotero/content/xpcom/data/item.js" line: 1537}]


let items = Zotero.getActiveZoteroPane().getSelectedItems()[0];
let parentitem = item = Zotero.Items.get(item.parentItemID);
yield Zotero.Attachments.importFromFile({
file: basestr + '.pdf',
parentItemID: parentitem.id
});

  • Best to post development questions to zotero-dev — we try to keep technical discussions there.

    You're not actually using the items variable there.
Sign In or Register to comment.