How can i hide the “Convert to deal” button from Lead doctype in Frappe CRM

How can i hide the “Convert to deal” button from Lead doctype in Frappe CRM , when there is no ERP next and Custom app in the site

I did not try it out myself but given Custom Actions

I would assume you can use “CRM Form Script” and the “setupForm” function to get the “Convert to deal” button and hide it.

Open the file apps/crm/frontend/src/pages/Lead.vue and find

<Button
:label=“__(‘Convert to Deal’)”
variant=“solid”
@click=“showConvertToDealModal = true”
/>

Add v-if=“false” to hide it:

<Button
v-if=“false”
:label=“__(‘Convert to Deal’)”
variant=“solid”
@click=“showConvertToDealModal = true”
/>

After saving, rebuild the frontend:

cd frappe-bench
bench build --app crm

This is a direct source edit. It will be overwritten if you update the CRM app. There’s no built-in setting or form script to hide this
button since it’s hardcoded in the template.

or second option with custom app .

can we hide the “convert to deal“ button using CRM Form Script ?

can we hide the “convert to deal“ button using CRM Form Script ?

@Anjana_Sajeevan So I tried it out.

You can use a CRM Form Script like this. Just make sure to activate the script using the button in the top-right corner.

function setupForm({ doc }) {
    console.log("test");
    const header = document.getElementById("app-header");

    if (header) {
      const convertButton = Array.from(header.querySelectorAll("button"))
        .find(btn => btn.textContent.trim() === "Convert to deal");
    
      if (convertButton) {
        convertButton.style.display = "none";
      }
    }
    return {
        actions: [],
    }
}

:warning: Important: This is not the intended use of the CRM Form Script feature, but at the moment I don’t see a better alternative.

The detection method using btn.textContent is not ideal. It will break if the user switches to a different language, since the button label will change. This is meant as a concept demonstration, not production-ready copy-paste code.

I would strongly advise against modifying the core code directly (as suggested by @tcbinfotech). Changing the source code will almost in 100% of the cases cause major upgrade issues and maintenance headaches in the future.

1 Like

thankyou
Like tjis using form script can we hide the deal page from the crm ?

Like tjis using form script can we hide the deal page from the crm ?

In theory propably yes by doing this for all doctypes. However, I would advise against it.