You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've written some code with the aim of being able to automatically add journal abbreviation tags when creating a new entry to make it easier for me to filter for specific journals.
My code works fine in the following scenario:
Adding DOIs manually.
When importing a PDF.
However, once I disengage from the Zotero software and add an entry via the zotero connector in Safari, I find that the journal's tags successfully appear automatically, but are then automatically removed!
Why is this?
/**
* add publicationTitle tags
*/
const Zotero = require("Zotero");
(async function () {
// Check if the trigger is created by a single item
if (!item) {
return; // No target item provided, return directly
}
// Define a mapping from publicationTitle to abbreviation (case insensitive)
const titleToAbbreviation = {
"academy of management journal": "AMJ",
"journal of advertising": "JA",
"journal of marketing": "JMar",
"journal of consumer psychology": "JCP",
"information systems research": "ISR",
"journal of consumer research": "JCR",
"journal of management": "JMan",
"journal of marketing research": "JMR",
"journal of the academy of marketing science": "JAMS",
"management science": "ManS",
"marketing science": "MarS",
"annual review of psychology": "ARP",
"international journal of information management": "IJIM",
"academy of management review": "AMR",
"psychological bulletin": "PB",
"american economic review": "AER",
"journal of financial economics": "JFE",
"journal of product innovation management": "JPIM",
"annual review of sociology": "ARS",
"journal of service research": "JSR",
"annals of tourism research": "ATR",
"journal of retailing": "JR",
"journal of travel research": "JTR",
"tourism management": "TM",
"journal of political economy": "JPE",
"production and operations management": "POM",
"journal of economic perspectives": "JEP",
"journal of personality and social psychology": "JPSP",
"international journal of research in marketing": "IJRM",
"journal of management information systems": "JMIS",
"psychological review": "PR",
"organization science": "OS",
"psychological science": "PS",
"organizational behavior and human decision processes": "OBHFP",
"current directions in psychological science": "CDPS",
"mis quarterly": "MIS",
"journal of the association for information systems": "JAIS",
"european journal of information systems": "EJIS",
"information systems journal": "ISJ",
"journal of information technology": "JIT",
"journal of strategic information systems": "JSIS",
"international journal of advertising": "IJA"
};
// Get the item's "publicationTitle" field
const publicationTitle = item.getField('publicationTitle');
// Convert to lowercase for case-insensitive comparison
const lowerCaseTitle = publicationTitle ? publicationTitle.toLowerCase() : '';
// Check if the publicationTitle is valid
if (lowerCaseTitle) {
// Titles starting with ACM, Nature, or Science
if (lowerCaseTitle.startsWith("acm")) {
item.addTag("ACM");
} else if (lowerCaseTitle.startsWith("nature")) {
item.addTag("Nature");
} else if (lowerCaseTitle.startsWith("science")) {
item.addTag("Science");
}
// Check if it is in the known publicationTitle mapping
else if (titleToAbbreviation[lowerCaseTitle]) {
// Get the abbreviation and add the tag
const tag = titleToAbbreviation[lowerCaseTitle];
item.addTag(tag);
}
}
})();
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I've written some code with the aim of being able to automatically add journal abbreviation tags when creating a new entry to make it easier for me to filter for specific journals.
My code works fine in the following scenario:
However, once I disengage from the Zotero software and add an entry via the zotero connector in Safari, I find that the journal's tags successfully appear automatically, but are then automatically removed!
Why is this?
Beta Was this translation helpful? Give feedback.
All reactions