You need to sign in to do that
Don't have an account?
Sibanee purohit
How to deactivate a record after clicking a custom button?
In my scenario I have some records and I need to create one custom button in detail page,by clicking that button that record should be deactivated or disabled...How can I achieve that functionality..Please help me
You can't disable that edit button. What you can do is remove that Edit Button from that page layout which you are assigning at the click of your custom button.
All Answers
Did you mean record type? Because there is no such thing in salesforce called 'deactivate a record'. Though, you can lock the record. But you can't 'deactivate or disable' it.
Thanks
You can't disable that edit button. What you can do is remove that Edit Button from that page layout which you are assigning at the click of your custom button.
For that you will have to write a javascript code for custom button, using that you can pass the ID of that record to an apex class where you will write your logic to assign the New read-only type page layout to your user.
Thanks
I created that button and by clicking it is redirecting to the readonly page.This is my code which I have written in detail page button,content source is Onclick javascript.Now I want to disable the 'Close ' button after clicking it once.For that I wrote a vf page and put that link here but it's going to vf page after clicking close button.How to disable this button ?
{!REQUIRESCRIPT("/soap/ajax/13.0/connection.js")}
fuction validate()
{
var oppObj = new sforce.SObject("Open_Selection__c");
oppObj.Id = '{!Open_Selection__c.Id}';
oppObj.Status__c = "Closed";
oppObj.RecordTypeId = '0126F000001YdAb';
var result = sforce.connection.update([oppObj]);
if (result[0].success=='false') {
alert(result[0].errors.message);
} else {
location.reload(true);
}
}