How to delete the content of the extra field for all references

Hello,

A plug-in has filled the ‘extra’ field of my entire library with information that I do not wish to mention and that appears when exporting bibliographies.
Is there a way to delete the information in the extra field of all references in the library without modifying each reference individually (it contains 3,200 documents and this would take a very long time...)

Thank you for your help !
  • edited 2 days ago
    Not with the UI, but it’s possible with a little bit of scripting. Since this will affect many items, I strongly recommend making a backup of your Zotero directory before proceeding. See: https://www.zotero.org/support/zotero_data

    Once your data is securely backed up, you can follow these steps to clear the value of the "extra" field in all selected items:

    1. Select the items you’d like to modify (use Cmd/Ctrl+A in the root of your library to select all).
    2. From the menu bar, choose Tools → Developer → Run JavaScript.
    3. Tick "Run as async function"
    4. Paste the following code:

    let clearExtra = async (i) => {
    if (i.isRegularItem()) {
    i.setField("extra", "");
    await i.saveTx();
    }
    };

    await Promise.all(
    ZoteroPane.getSelectedItems().map(i => clearExtra(i))
    );


    5. Press Run.

    (I've edited the code few minutes after posting initially to make sure it correctly waits for the changes to execute)
  • thank you so much !
Sign In or Register to comment.