Hi everyone,
I’m trying to hide the “Assigned To” section (.form-assignments
class) on all doctypes using plain JavaScript. I’ve added a global JS file using the doctype_js
hook in hooks.py
like this:
doctype_js = { "*": "public/js/doctype.js" }
In that file, I tried the following:
js
frappe.ui.form.on('*', {
onload: function () {
const interval = setInterval(() => {
const assignmentSection = document.querySelector(".form-assignments");
if (assignmentSection) {
assignmentSection.style.display = "none";
clearInterval(interval);
}
}, 300);
}
});
But nothing works — the assignment section is still visible.
What I tried:
-
Ensured the path to the JS file is correct.
-
Tried both onload and refresh events.
-
Tried DOMContentLoaded and setTimeout approaches.
-
Cleared cache using bench clear-cache and Ctrl + Shift + R.
-
Environment:
Frappe version: 15
Custom app with doctype_js hook targeting “*”.
Question:
What is the correct way to hide the .form-assignments section globally (for all doctypes)?
Any help would be appreciated — thank you