More Change Item JavaScript Examples for non-developers, please!

I have very little (zero?) programming knowledge, but have been able to create a few invaluable JavaScripts based on these examples:

https://www.zotero.org/support/dev/client_coding/javascript_api#adding_items_and_modifying_data
https://forums.zotero.org/discussion/78245/i-need-javascript-code-to-change-a-lot-items-type

Could any benevolent coder post a few more examples? I've enrolled in online JavaScript courses, but I'm devoting hours to a task that I'm sure someone competent could do in minutes... (Using Zotero7, so Zutilo doesn't seem to be a solution)

I'm currently stumped on how to batch add the same group of *multiple* creators (authors) to a selected set of items.
  • Solved my basic problem above! I was just missing a comma between the creators...

    //set Creator of selected to new values
    const zoteroPane = Zotero.getActiveZoteroPane();
    const selected = zoteroPane.getSelectedItems();

    for (const item of selected) {

    item.setCreators(
    [
    {
    firstName: "Alice",
    lastName: "Buchanan",
    creatorType: "author"
    },
    {
    firstName: "Charles",
    lastName: "Dickens",
    creatorType: "author"
    }
    ])
    await item.save();
    }
    ;
Sign In or Register to comment.