function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
woodmanzeewoodmanzee 

Custom Button and Checkbox

Is it possible to create a custom button on the Contact page that checks a checkbox (a custom field)?  I'm having trouble writing some javascript that would accomplish that.  Any help?

Shashikant SharmaShashikant Sharma

You can create a Detail Page Button on contact object and set it's behaviour as Execute Javascript

In Contact source you can write your js , i have alerted this 

 

 

alert('{!Contact.CustomField__c}');

 

And please add this detail button to layout also. update your page layout.

For checkbox field it will show 1 and 0 for true and false

Rahul SharmaRahul Sharma

Put this javascript code :

It will work in your case.

 

{!REQUIRESCRIPT("/soap/ajax/20.0/connection.js")}	
var a = new sforce.SObject("Contact");
a.Id = "{!Contact.Id}";
a.UpdateContact_Type__c = true;
// In my case Boolean field is UpdateContact_Type__c Change it as yours
sforce.connection.update([a]);
location.reload(true);

Let me know if you still face any issues. :)

TeddyAbleTeddyAble

Hello 

 

that was exactly what i had issues with also 

 

But thank you for ur tip as i was able to manipulate urs to make mine work

 

Regards,