Skip to content

Instantly share code, notes, and snippets.

@alexvdvalk
Last active December 12, 2025 15:02
Show Gist options
  • Select an option

  • Save alexvdvalk/f1a90c91a2de3a9018d11bb8c198d316 to your computer and use it in GitHub Desktop.

Select an option

Save alexvdvalk/f1a90c91a2de3a9018d11bb8c198d316 to your computer and use it in GitHub Desktop.
hide 'create opportunity' field.ts
// Create page interaction
// Page = "record"
// Action = "Modify Tabs"
// Enabled = true
// This page interaction will hide some opportunity related fields leads / elements.
// Run on the overview tab, which means this will run once when the entity page loads
if (item.label !== "TABS.OVERVIEW") return;
const hideCreateOpportunityField = () => {
// if the page is closed, the url is actually changed to the home page.
// in this case, we need to stop the interval.
if (document.URL === "https://app.bullhornstaffing.com/content/home") {
stopInterval();
return;
}
const getElement = (selector) => {
return document.querySelector(selector + ":not([hidden])");
};
const elementsToHide = [
getElement ('opportunities-card'), // Opportunities card on client
getElement("novo-option[data-automation-id=add-opportunity-action]"), //on Client, hide the "Add Opportunity" button in the 'select an action'
getElement(
"novo-option[data-automation-id=find-matching-candidate-action]" // Candidate find matching candidate button
),
getElement("novo-option[data-automation-id=find-matching-job-action]"), // Candidate find matching jobs button
// find the control with the key "create-opportunity"
getElement('novo-control[data-control-key="create-opportunity"]'), // Create Opportunity control
getElement("convert-lead-modal h2"), // hide the "Would you like to create a new Opportunity? on already converted leads,
getElement("button[data-automation-id=convert-modal-next-button]"), // hide the "Next" button on already converted leads
];
console.log("elementsToHide", {elementsToHide, document, window});
for (const element of elementsToHide) {
if (element) element.hidden = true;
}
};
let i;
const startInterval = () => {
console.log("Starting interval");
i = setInterval(hideCreateOpportunityField, 500);
};
const stopInterval = () => {
console.log("Stopping interval");
clearInterval(i);
};
// check for this element every 500ms
// Start the interval when the page loads
startInterval();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment