Reload Doctype through Script

Hi Frappe Community, I am using many heavy server and client scripts to customize html custom fields in some of my doctypes.

I am also using buttons inside these html fields to call server scripts.

My problem right now is, that I need to update/refresh the form after clicking such a button in a html field, which is not working for me :frowning:

Does any of you have I idea, please? :pray:

I have tried following refresh types without any success:

  1. Form Reload using cur_frm.reload_doc()

    cur_frm.reload_doc();
    
  2. Page Reload using location.reload()

    setTimeout(() => { location.reload(); }, 500); // Delayed refresh
    
  3. Custom Event Dispatch

    document.dispatchEvent(new Event('custom_refresh')); // Emit custom event
    
  4. Form Trigger using frappe.ui.form.trigger

    frappe.ui.form.trigger(cur_frm.doc.doctype, 'refresh');
    
  5. Full Page Reload with Delayed Refresh

    setTimeout(() => { location.reload(); }, 500); // Delayed refresh
    
  6. Console Logging for Server Response

    console.log("Server Response:", response);
    

Hi @pronext:

Use
frm.reload_doc()

cur_frm will not work (just in browser console)
Hope this helps.

thanks, I guess my problem was that my script was waiting for something and did not get to that correctly. ajusted and worked nicely.