Is there a javascript function of zotero to delete the notes of an item?

46 views
Skip to first unread message

Minyi Han

unread,
Aug 7, 2021, 5:01:25 AM8/7/21
to zotero-dev
Hello there

I want to call this function to remove all the notes of selected item in my extension.

Best wishes

Minyi

Minyi Han

unread,
Aug 9, 2021, 8:08:03 PM8/9/21
to zotero-dev
Now, Zotero.Items.erase(item.getNotes()) was used, however, this function will delete the note directly, and the note can not be restored from Trash of zotero, is there any more proper?

Dan Stillman

unread,
Aug 11, 2021, 3:51:50 AM8/11/21
to zoter...@googlegroups.com
On 8/9/21 8:08 PM, Minyi Han wrote:
Now, Zotero.Items.erase(item.getNotes()) was used, however, this function will delete the note directly, and the note can not be restored from Trash of zotero, is there any more proper?

`await Zotero.Items.trash(ids)`
Message has been deleted

Dan Stillman

unread,
Aug 25, 2021, 2:47:07 PM8/25/21
to zoter...@googlegroups.com
On 8/25/21 5:21 AM, linxz...@gmail.com wrote:
> Can I use `await Zotero.Items.trash(ids)`  in another type of item
> except for note?
> I try to move a webpage item to the trash, an error shows in debug:
> Error Not in transaction.

Various data layer methods are available in both `foo()` and `fooTx()`
versions, with the former requiring a DB transaction to already be
started and the latter starting one itself. If you're not in a
transaction, you'd need to use `trashTx()`.

- Dan

Minyi Han

unread,
Sep 3, 2021, 8:25:27 AM9/3/21
to zotero-dev
thanks, got it
Reply all
Reply to author
Forward
0 new messages