getting the parent item of annotation

47 views
Skip to first unread message

ChinJ Cheung

unread,
Dec 16, 2023, 2:19:22 AM12/16/23
to zotero-dev
Hello,
I want to know how to get the parentitem of annotation?
When I select a annotation
code: annoitem = item.parentItem
if (annoitem) {
let creators = annoitem.getCreators();
year = Zotero.Date.strToDate(annoitem.getField("date")).year
if (creators.length > 0) {
let firstAuthorLastName = creators[0].lastName;
authors = firstAuthorLastName + " et al.";
} else {
authors = "No authors found.";
}
} else {
authors = "Parent item not found.";
}
this will display "No authors found."

Abe Jellinek

unread,
Dec 16, 2023, 8:54:26 AM12/16/23
to zoter...@googlegroups.com
The annotation’s parent is the attachment it’s on, and the attachment’s parent (if it has one) is the item.

On Dec 16, 2023, at 2:19 AM, ChinJ Cheung <chinj...@gmail.com> wrote:

Hello,
--
You received this message because you are subscribed to the Google Groups "zotero-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to zotero-dev+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/zotero-dev/c8ce1cfa-31e5-4a26-9bd1-772916e5839en%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages