I created a few custom doctypes to better suit my company’s needs i need to use a button in one of those forms to create a new item with the same name as the current opened form, i need it to go create this item in the background using only client side script “javascript”
trial is the doctype i have my button “Update” in and i use this button to create a new record in the “trial2” doctype. I need to find a way to work on this code to make is save the record without adding a route function and directing me to the newly created doctype to save it myself. qty1 and amount are both fields found in both doctypes.
frappe.ui.form.on("trial", {
refresh: function(frm) {
frm.add_custom_button(__("Update"),
function() {
tn = frappe.model.make_new_doc_and_get_name("trial2");
locals["trial2"][tn].qty1 = frm.doc.amount;
});
}
});
Best regards
I dont need this anymore and i dont know how to delete it
@Mohammed_ElKadee Have you directly edited the javascript file of your doctype or have you done this with a custom script?
Shouldn’t be too hard either way.
Piece of cake:
- Search for “custom script list” in the awesome bar, which will bring you to your list of custom scripts.
- You can select it and delete it from there.
Let me know if you have any trouble.
i dont really understand what youre saying. i finished the code and its working now.
I think I misunderstood what you meant in your original post. I thought you wanted help deleting your custom script; I think you wanted to delete the post.
I propose that you post your working code here (so that your non-working code doesn’t serve as a bad example) and mark it as a solution. I try to do this when I end up answering my own questions because somebody else will have the same problem at some point and it’s a easy way to give back to the community.
2 Likes