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
BaconBacon 

Custom Button Field Update

I want a custom button (on a custom object) to execute a field update.  The button is called "Vote" and the field is a number field called "Votes".  The pressing of the button would increase the value of the Votes field by 1.

 

Can anyone help me in this case?

Best Answer chosen by Admin (Salesforce Developers) 
jhenningjhenning

Bacon,

 

You have a couple of choices. You can create a custom button, write some javascript that runs when the button is clicked. Or you can write a Visual Force page with a custom Apex controller that does the update. 

 

John

Technical Instructor

Salesforce.com

 

All Answers

jhenningjhenning

Bacon,

 

You have a couple of choices. You can create a custom button, write some javascript that runs when the button is clicked. Or you can write a Visual Force page with a custom Apex controller that does the update. 

 

John

Technical Instructor

Salesforce.com

 

This was selected as the best answer
BaconBacon
Thanks John, any idea of what that javascript would look like for the custom button?
jhenningjhenning

Bacon,

 

Take a look at the Cookbook http://wiki.developerforce.com/index.php/Force_Platform_Cookbook

 

There is an example called "Creating a Button wth Apex". It may give you some ideas for your requirements.

Phil WaltonPhil Walton

Hi

Is this code still available as the link does not work now. I also want to build a Button which updates a field on a record. I am sure it is easy but my first tries still error. Many thanks!

Phil