Send sql query in custom script

Can we send sql query to fetch few records using 2-3 tables in Custom client side scripts.

Yes, you can send in sql.

    "query":"select name form tabCustomer where name like %s",
    "txt": "sva"

What do you mean by 2-3 tables. From what is assume you want to filter results based on columns in multiple tables.

If yes, then you can apply join and and filter stuff out.

Hi Bhupesh
Can you give me some reference for this javascript code to understand more.

cur_frm.set_query("customer", function (doc, cdt, cdn) {
    return {
        "query": "select name form tabCustomer where name like %s",
        "txt": "sva"

I am not sure, but we may have removed this in version 5. It is a security risk.

Hi rmehta
Can we update status of opportunity on_submit of sales_order. I have found this update_enquiry_status function with which we can update the status, but can i call it using javascipt.

I am trying to call this custom script on on_submit of sales order but its not calling or when i am testing this code of this script from console its working properly.
cur_frm.cscript.custom_on_submit = function(doc) {
confirm(__("Quotation ") + doc.sales_order_details[0].prevdoc_docname);

Can anyone help me on this.

custom_on_submit is called after submit (I think)

Add a serverside hook to build this.

Hi rmetha
i need to run it after submit only, but this script is not running.
frappe.ui.form.on(“Sales Order”, “on_submit”, function(frm) {
i tried this snippet as well,