Try ERPNext Try Frappe Cloud Buy Support Partners Foundation

Custom Javascript for Specific ERPNext Doctypes

Is there a way to add custom scripts to a specific docytpe, without adding it to all of ERPNext (via build.json)? I’m looking for something like a cross between the Custom Script doctype and fixtures, where I can store the javascript in my app and have it only load on the appropriate doctype.

I think I figured it out. It can be done via hooks.py:

page_js = {"page_name" : "public/js/file.js"}

That will load things up in specific Pages. If you want to load the js in specific Doctype forms, you’d use the doctype_js hook.

doctype_js = {"#DocType#": "#public/js/custom_js.js#"}

Thanks for the correction!