How to get newly created doc name in web form

Iam trying get the doc name when ever it is submitted in web form

Did you find any solution?
I want the document’s name in the “after save” event. I tried this, but nothing worked. frappe.web_form.doc.web_form_name
frappe.web_form.name

@ejaaz @Vinod_Gajjela

any solution??

frappe.web_form.after_save = function(doc) {
    // The 'doc' parameter contains the saved document
    console.log("Newly created doc name:", doc.name);
    // You can now use doc.name as needed
};

Try this