Question

Hide DELETE button on condition

Hello,

 

I'm trying to make the DELETE button on Lead to be available only for certain users. This is my code:
 

In diff:

 

In methods:


In console IsDeleteButtonVisible appears as true, but the button is hidden no matter what.

Like 0

Like

2 comments

Change events to attributes bound in row action buttons do not occur. So changing the attribute won't change the button's properties. The only way I've been able to accomplish this is to override the onRowAction with tag delete to display a message if the action is not allowed. I've also hidden that using some conditional CSS as well, but that route is a bit hacky.

Ryan

You can hide the "delete button" on the detail inheriting from Detail Schema where you need, and add some of the following pieces of code to remove New, Copy, Delete & Edit

 

If you also want to remove delete in Methods, just need to add:

 

// remove the delete option
			getDeleteRecordMenuItem: Terrasoft.emptyFn	  

 

define("NdosSchema26d0e559Detail", [], function() {
	return {
		entitySchemaName: "NdosProductosServiciosRequisionCompra",
		details: /**SCHEMA_DETAILS*/{}/**SCHEMA_DETAILS*/,
		diff: /**SCHEMA_DIFF*/[]/**SCHEMA_DIFF*/,
		methods: {
			// Remove New record
			getAddRecordButtonVisible: function() {
				return false;
 
			},
 
			// remove the edit option           
			getEditRecordMenuItem: Terrasoft.emptyFn,
 
			// remove the copy option
			getCopyRecordMenuItem: Terrasoft.emptyFn,
 
			// remove the delete option
			getDeleteRecordMenuItem: Terrasoft.emptyFn	          
        }
	};
});

 

Regards

Julio

Show all comments