How to hide Dashboard link when Field data is changed

Hi there.

I want to figure out how to hide or show a Dashboard link when some Field in the DocType is changed.

So in example:

I got the standard Project DocType and ther is my Selectable field project_type.
When I select the second type of the Project then I want to hide some links at the top Dashboard, like a Material Request and so on.

Please let me know how to figure out.


1 Like


One way I could think of achieving this is through a javascript tweak - project.js file
Add this function below the show_dashboard function -

project_type: function(frm) {
		if(frm.doc.project_type && frm.doc.project_type == 'Other') {
			$("[data-doctype='Material Request']").hide();
			$("[data-doctype='Purchase Order']").hide();
		} else {
			$("[data-doctype='Material Request']").show();
			$("[data-doctype='Purchase Order']").show();

Also you’ll need to add this in the onload function frm.trigger('project_type');
This might maybe give you some idea :+1:


Hi. Thank you for the perfect solution.
I just need to check back what do you have told me.
I have added the desired code to my .js
When I’m good understand then this code will be fine, right?!

So it looks good, but. After a refresh the hidden links are come back.
Thats the problem. So it’s nearly a good solution but not 100%

I´d recommend that you change the event trigger (project_type) on line 55 to onload or refresh so it “triggers” when you load or refresh the document.


Hi, can you please visualise what you mean. I’m newbie so please show me what you mean. Thanks.

// posible hide link from dashboard
project_type: function(frm) {
if(frm.doc.project_type && frm.doc.project_type == ‘Tűzvédelem’) {
$(“[data-doctype=‘Engine Repair Sheet’]”).hide();
} else {
$(“[data-doctype=‘Engine Repair Sheet’]”).show();

where to add this trigger?

Use it this way:



I did mention inserting the trigger in onload :sweat_smile: , so that the links dont come back

Thank you Chabito79. Now works like a charm.
Another question. Can I replicate this function to another binded DocType? So I mean for another project_type with another hide?
Or I need to add it to this function too?

Just add it to any other doctype js file


Do you know how to hide the labels?

I can’t figure how to.

Can we Did this Using Custom Script ??

i used to hide supplier quotation button at Opportunity at below script, you can edit in your use case

frappe.ui.form.on('Opportunity', {
	refresh(frm) {
$("[data-doctype='Supplier Quotation']").hide();

How to do this on custom script?

How can I make a script to just remove the “+” and link on the dashboard but not hide it when the status of the project is already complete?

The “+” and the link on the dashboard doctypes leads to a bug. Because we can still create and submit a document eventhough the project is already tagged as completed.

Can you also help me?

Thanks it works …but how can we hide the heading of the particular ‘+’ link

Did you know how i can hide the labels???

How i can hide the lables ??

i also hide button, its not show any title at dashboard.

  $("[data-doctype='Supplier Quotation']").hide();'Supplier Quotation'),  __('Create'));