You need to sign in to do that
Don't have an account?
How to disable a custom button on standard page layout
Hi There,
having custom button , when I click that button if one of my field on that object is ":Success" then diable a button. otherwise don't diable it.
I am having below code on my custom button , it is disabling button , but when i refersh the page again it is enabling back.
but I want to disable that button if the field is "success", enable that button back if user changes any field or if they change form "success" some thing else not when they refersh the page.
var testSuccess='{!somename__c}';
alert("testsuccess="+testSuccess);
if(testSuccess=='Success'){
this.disabled = true;
this.className = 'btnDisabled'
}
is that possible using custom button ? if it please let me know how to do that.
That's why, initial suggestion was to put an alert message instead on disabling the button.
if(testSuccess=='Success'){
alert('This record has already been processed');
} else {
// write your logic to process the record
}
All Answers
You cannot manipulate Custom Buttons on a Standard page.
However, if you want to go the extra trouble and implement jquery and all that (it is quite a bit of work) on the home page layout, see the blog post by tehnrd (Jason) and that is what you need to do. He explained it well.
http://www.tehnrd.com/show-and-hide-buttons-on-page-layouts/
Thanks,
Can you please give me an idea how to do that, or if you have sample code that will be great help.
It looks like you already have the code:
var testSuccess='{!somename__c}';
alert("testsuccess="+testSuccess);
if(testSuccess=='Success'){
alert('This record has already been processed');
} else {
// write your logic to process the record
}
p.s. Please leave your feedback (Kudos), if the suggested solution is working.
Thank you for ypur replay, But If refersh the page again it is enabling back even if somename__c='Success'.
I want If the somename__c='Success' if i refersh the it should not enable , it should be enbled if i change the text from "Success" to something else.
Is it possible ?
That's why, initial suggestion was to put an alert message instead on disabling the button.
if(testSuccess=='Success'){
alert('This record has already been processed');
} else {
// write your logic to process the record
}