Issue with frappe.get_doc Method Returning Null in Custom Page JS

Hello, Frappe community,

I’m currently encountering an issue with the frappe.get_doc js method in my custom page’s JavaScript file. When I call frappe.get_doc in my custom page, it returns null. However, I’ve noticed that on the user-profile page, it works perfectly fine.

Could someone shed some light on why this might be happening? Is there a specific configuration or setup required for frappe.get_doc to work correctly on custom pages? I’ve checked my code thoroughly and ensured that all necessary dependencies are included.

Any insights or suggestions would be greatly appreciated. Thank you in advance for your help!

Best regards,
Gopi Krishnan

You may get some reference from the below issue:

or you can use frappe.db.get_doc() for JS.