Is Zotero.DB.executeTransaction still a thing?

17 views
Skip to first unread message

maie...@gmail.com

unread,
Mar 31, 2026, 9:28:40 AM (4 days ago) Mar 31
to zotero-dev
Hi, 

in the context of my other message regarding that function:

```
async addOrderNote() {
      SUL.log("Called addOrderNote from main file");
      const ZoteroPane = Zotero.getActiveZoteroPane();
      const selectedItems = ZoteroPane.getSelectedItems();
      const items = selectedItems.filter(
        (item) => item.itemTypeID === Zotero.ItemTypes.getID("book")
      );
      for (const item of items) {
        const tags = item.getTags();
        const { ddcs, orderCodes, budgetCode } = SUL.orderNote.extractTags(tags);
        const orderNote = SUL.orderNote.constructOrderNote({ ddcs, orderCodes, budgetCode });
        item.setField("volume", orderNote);
        await item.saveTx();
      }
    },
```

I have the impression that the item.saveTx() processes each item essentially in a sequential way. In the docs, I've seen Zotero.DB.executeTransaction() which can be used with item.save() instead of .saveTx().

Is that still supported in Zotero 8? Also, would that be a good fit for my use case? Is my impression correct that would mean we only really save once at the end, which should speed things up quite a bit?

Best,
Denis 

Xiangyu Wang

unread,
Mar 31, 2026, 9:42:08 AM (4 days ago) Mar 31
to zoter...@googlegroups.com
This part isn’t changed in Zotero 8, afaik. So yes you can (and probably should) save multiple changes in one transaction. The performance gains might only be obvious with a significant number of items in your case though.

--
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 visit https://groups.google.com/d/msgid/zotero-dev/0b228cfd-9ad2-46d0-898d-2b72788353f2n%40googlegroups.com.

maie...@gmail.com

unread,
Mar 31, 2026, 9:49:24 AM (4 days ago) Mar 31
to zotero-dev
Thanks. With about 50+ items in a batch it feels significantly faster.
Reply all
Reply to author
Forward
0 new messages